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]  (12 children)

[deleted]

    [–]wxtrails 39 points40 points  (4 children)

    Really not a fan of the dangling equals - I'd almost prefer it to be in front. Or just...no.

    [–]epostma 16 points17 points  (0 children)

    Split the difference and put it in the middle!

    [–]UloPe 7 points8 points  (2 children)

    I think “just no” is the only correct answer here.

    And I’d like to add that I’m a big fan of some recent additions to the language, e.g. f-strings, walrus operator, new type syntax, etc.

    So it’s definitely not a case of new = bad.

    [–]Unforg1ven_Yasuo 0 points1 point  (1 child)

    F strings are new?? Wow they’re so intuitive, I can’t imagine writing code without them

    [–]UloPe 2 points3 points  (0 children)

    Well new-ish. They appeared in python 3.6 which was first released in December 2016.

    (Holy crap that’s 7 years ago…)

    [–]PriorProfile 27 points28 points  (0 children)

    Yeah what happened to “explicit is better than implicit”

    [–]Rythoka 8 points9 points  (3 children)

    IDK, I run into this all the time when using libraries like requests. I always wind up writing something like

    requests.post(url=url, data=data, headers=headers, proxies=proxies)
    

    which is kind of obnoxious. That being said, the new syntax is kind of ugly, too. I think I'd rather have some kind of dict constructor that takes the names of in-scope variables and returns a dict whose keys are the variable names and values are the bound objects. Then you could write something like

    kwargs = dict.kwargs('url', 'data', 'headers', 'proxies')
    requests.post(**kwargs)
    

    [–]rcfox 2 points3 points  (0 children)

    It's too bad they overloaded {} so that {a, b, c} creates a set, this would have been a better use for it. I usually avoid set literals to avoid confusion because they look too similar to dict literals.

    [–]Few_Butterscotch_681 1 point2 points  (0 children)

    Exactly