realization: no assignments inside expressions

Simon Burton simon at
Fri May 19 01:48:05 CEST 2006

I've been doing a little c programming again (ouch!) and it's just hit
why python does not allow assignment inside expressions (as in c):
because it is absolutely essential that all assignments are as visible
as possible. In python the assignment is the declaration; when
are as cheap as this it's hard not to fall to the temptation to re-use
variable unknowingly. I am constantly scanning the line of assignments
to see what variables are already live, and I just realised how easy it
to do that. Up to now I guess I thought it was just a restriction to
stop new
users of python from writing too obfuscated code.



More information about the Python-list mailing list