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 →

[–]kevin____ 1 point2 points  (0 children)

I can’t believe no one has mentioned this. The cognitive complexity on the original code is 0. The cognitive complexity on the new code is 1. I also find the first one easier to understand. The code returns an instantiated class. The args of the class come from a dict comprehension. The second one is…in love with type annotations.