4 ms·
You don’t write a parser from scratch, you use the ast module. The rest of this is excessive negativity trying to sound superior while ignoring history. (I ev
by mixmastamyk 3y ago
You don’t write a parser from scratch, you use the ast module.
The rest of this is excessive negativity trying to sound superior while ignoring history.
(I even agree about the match statement and walrus, but fstring is a very useful compromise.)
- otherme123 3y agoI'm using walrus a lot, can't find any negative: it's clear what it does, and the code feels cleaner.
- mixmastamyk 3y agoPython already had the “as” and assignment statements so didn’t need three ways to do it. Remember the Zen? (99% of the time walrus is used in “if” or “while” with one expression, which as handles fine.) Also, along with typing contributes to the excessive “colon blow” of modern Python.
- memefrog 3y agoThere's no 'as' in Python if or while statements, only with. >>> if True as a: File "<stdin>", line 1 if True as a: ^^ SyntaxError: invalid syntax
- mixmastamyk 3y agoIndeed. Coulda been.
- michaelcampbell 3y ago> Remember the Zen? Like Django's "explicit is better than implicit... no, wait, hold my beer" magic.
- crabbone 3y agoWhy would I write it in Python? It's the worst language to do that...