5 ms·
The walrus operator was definitely a mistake. But type annotations, pattern matching, attrs/dataclasses, and f-strings are significant improvements.
by neolog 6y ago
The walrus operator was definitely a mistake. But type annotations, pattern matching, attrs/dataclasses, and f-strings are significant improvements.
- jsmeaton 6y agoSee though, this is the issue. What you see as a useful or mistaken feature is likely a different set to another user, just as we’ve seen above. I think it’s a mistake to defer to the zen of python without considering the PEPs themselves which do discuss trade offs. (I’ll note that you didn’t make that claim but GP did).
- neolog 6y agoTbh I think a consensus of expert Pythonistas would agree with me. Walrus only got through because of the "dictatorship".
- jsmeaton 6y agoPerhaps :) That’s not a hill I’m willing to die on but I agree with the positives from your list. And the small handful of times I’ve used walrus have been nice, but not game changing.
- musingsole 6y agoLanguage features of this type should be nice and not game changing. It's how spoken word languages evolve. If every change was game-changing, it'd only be a few mutations until a dialect became a language in its own right. In reality, you get countless dialects frequently with features that eventually die off and new languages rarely and only in the aggregate.
- GeorgeTirebiter 6y agoSeems to me the 'sweet spot' for a language is a careful balance of continuing to evolve - slowly, carefully - and to not become so large as to 'not fit into one head'. Python3.9 is not yet at the 'too big for one head'; but 3.xx could be. Perhaps old-style features need to be removed, and only available via some sort of "from __past__ import old-feature-set"
- neolog 6y agoThey could just deprecate without removing.
- musingsole 6y agoIt's hard for me to separate a language from what it is used to accomplish, and from that perspective, Python has been far too large to fit in one head for a good long time. Perhaps that is why I don't find any compulsion for language purity.
- neolog 6y ago> too large to fit in one head is it? I don't think the core language is that big. The libraries are big of course.
- pansa2 6y agoAn example of core language complexity: if asked, could you explain what all of these do? https://twitter.com/raymondh/status/1280988785841278976 https://twitter.com/raymondh/status/1280988785841278976
- coldtea 6y ago>Walrus only got through because of the "dictatorship". Well, then again I wouldn't consider anybody a more expert Pythonista than Guido.
- bobbylarrybobby 6y agoCan you explain why you don’t like the walrus operator? I personally love it.
- neolog 6y ago- Languages should only make special syntax for very common or very important needs. Neither applies here. - It violates the longstanding Python rule that assignments don't escape the enclosing scope.
- smetj 6y ago> It violates the longstanding Python rule that assignments don't escape the enclosing scope. But doesn't that violate the longstanding Python rule that A Foolish Consistency is the Hobgoblin of Little Minds ?
- neolog 6y agoNo. Assignment leaking into enclosing scope is a bad idea.
- beforeolives 6y agoThe trick is tell when striving for consistensy is foolish and when it isn't. Otherwise you would always be able to fall back on this quote to justify creating unuseable code/frameworks/projects/languages.
- bobbylarrybobby 6y agoDon’t assignments already escape scope? if True: x = 1 print(x)
- neolog 6y ago`if` blocks don't make a scope. Comprehensions do.
- mixmastamyk 6y ago
- coldtea 6y ago>The walrus operator was definitely a mistake. Was it tho? It's one of my favorite improvements, and has no actual downside.