assignment expression peeve
Paul Rubin
http
Wed Oct 15 18:47:57 EDT 2003
More information about the Python-list mailing list
Wed Oct 15 18:47:57 EDT 2003
- Previous message (by thread): assignment expression peeve
- Next message (by thread): assignment expression peeve
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Carl Banks <imbosol at aerojockey.invalid> writes: > >> The real reason is that assignment expressions lead to all kinds of > >> ugly and unreadable code. This is because there is no linguistic > >> analogue for assignment as an expression. > > > > Swell, tell me the linguistic analog for metaclasses. Or should those > > be removed too? > > Paragraph that defines some of its own words? > > Seriously, you're comparing apples to oranges here. I'm comparing > syntax here, and there's nothing syntactical about metaclasses. If > you want to compare a class statement to natural language, that works. Actually, assignment expressions happen in natural language too. In English you could say "A guy named Bob walks into a bar". In Python with assignment expressions, you'd write bar.enter(bob := Guy()) Without assignment expressions you'd have to say something like bob = Guy() bar.enter(bob) which in English would be two sentences: "There's a guy named Bob. Bob walks into a bar." As I see it, the one-sentence, assignment-expression version is perfectly natural and less stilted-sounding in normal conversation.
- Previous message (by thread): assignment expression peeve
- Next message (by thread): assignment expression peeve
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list