realization: no assignments inside expressions

S

Simon Burton

I've been doing a little c programming again (ouch!) and it's just hit
me
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
declarations
are as cheap as this it's hard not to fall to the temptation to re-use
a
variable unknowingly. I am constantly scanning the line of assignments
to see what variables are already live, and I just realised how easy it
is
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.

wow.

Simon.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,298
Messages
2,571,540
Members
48,275
Latest member
tetedenuit01

Latest Threads

Top