New syntax for blocks

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Thu Nov 12 15:27:31 EST 2009


r a écrit :
-snip)
> Just thinking out loud here...what if variable assignments could
> return a value... hmmm? Not to them selfs of course but to a caller,
> like an if statement...
> 
> if a=openfile:
>   # do something with a

Congratulations, you just reinvented one of the most infamous source of
bugs in C, C++, Java, PHP, javascript and quite a few other languages.
Believe it or not, but not allowing this in Python was a very deliberate
design choice.

Now whether it was a good choice is another troll^Mtopic !-)



More information about the Python-list mailing list