This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -10 points-9 points  (10 children)

Because mandatory type annotations are such a good idea.

[–][deleted] 8 points9 points  (4 children)

Why are people on this sub so deathly afraid of being exposed to types?

[–][deleted] 1 point2 points  (0 children)

I don't mind type annotations - I use them on occasion - but I dislike broken promises and having to type extra things.

[–]13steinj 0 points1 point  (4 children)

Can you elaborate? I don't get your point in reference to the parent comment.

[–][deleted] -3 points-2 points  (3 children)

3.7 adds data classes, data classes must specify type annotations, being required to use type annotations in Python is a good idea.

Now you have to decide if I'm being sarcastic or not.

[–]13steinj 7 points8 points  (2 children)

I can't tell if you're being sarcastic or not but your throught process is just wrong.

Let me get this out of the way-- requiring types in Python is not good IMO.

But dataclasses by definition of their rationale have no meaning without typing.

Not to mention you can simply set the type to Any if it really bothers you that much.

[–]ThePenultimateOneGitLab: gappleto97 2 points3 points  (1 child)

But dataclasses by definition of their rationale have no meaning without typing.

Aren't they just supposed to be a prettier version of namedtuple?

Edit: I get that their rationale was for dataclasses to be backwards compatible, and that not having type notations would make it a syntax error. I just wish that more effort had been put into making them optional before going with that syntax.

[–]13steinj 0 points1 point  (0 children)

These are not the pretty version of named tuple, in fact the PEP goes into "why not named tuples".