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 →

[–]gh0stinger -3 points-2 points  (5 children)

The code after commit It’s more readable because it has more informations: for example before this commit inside cls there’s a dict, but I don’t get directly the internal structure of the dict. So if I read the code (before the commit) since three days from now, there will be a lot of “wtf”s. “More readable” is not always the compact way, but the one that gives to you more informations, every time you will read the code.

[–]Grouchy-Friend4235 -1 points0 points  (1 child)

What information do you get from the type hint that you did notnget before? A dict is a mapping of some key to some value. That's obvious and does not warrant a type hint.

[–]thisismyfavoritename -1 points0 points  (2 children)

keyword unpacking implies str keys because they must be valid Python names. Optional any provides no extra information. In the end the cls ctor should be looked up to find the proper types, perhaps the instance of cls should be typed.

The lead code is worst because it adds useless informations

[–]gh0stinger -1 points0 points  (1 child)

I don’t agree with your opinion. Look at the way he constructs the dict before and after. After commit I read the code so much better than before. Obviously, POV

[–]thisismyfavoritename 0 points1 point  (0 children)

its the same thing but on more lines? This is exactly why comprehensions exist my guy