assignment expression peeve

Andrew Dalke adalke at mindspring.com
Wed Oct 15 19:30:44 EDT 2003


Paul Rubin
> 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)

Well that's a stretch.  How would you write the code for
  "A guy walks into a bar.  His name is Bob."
  "Bob, a guy, walks into a bar"
  "A guy walks into a bar.  'Hi Bob', says the tender upon seeing him."
  "As the guy walks into the bar he pulls off his conference name tag
     with it's disgustingly chirpy 'Hi, my name is Bob' annoucement.
     He needs a drink.  Now."
  "Like all other guys that Guy Fawkes day, Bob bobbed into Bob's Bar."
  "Two nuns walk into a bar.  Third one ducks."

Err, sorry, got carried away with the last ones.  :)

                    Andrew
                    dalke at dalkescientific.com







More information about the Python-list mailing list