a little trap revealed (was Re: Let's Talk About Lambda Functions!)
Steve Holden
sholden at holdenweb.com
Mon Jul 29 11:10:11 EDT 2002
"Michele Simionato" <mis6 at pitt.edu> wrote in message
news:2259b0e2.0207280652.202f1721 at posting.google.com...
> Now I see the source of my confusion. I thought the print "statement"
> was
> actually an expression with result None. However in Python
>
> result=print("something")
>
> gives a syntax error. Then my question is: why Guido decided to keep
> the distinction between statements (with no value returned) and
> expressions ? what are the advantages ? is it a matter of personal
> taste ? Sorry if these
> questions sounds naive,
>
He made that decision for the same reason he decided not to allow
assignments inside expressions. You can find the justification in the FAQ if
you look for it ... 6.30: Why can't I use assignment in an expression.
regards
-----------------------------------------------------------------------
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------
More information about the Python-list
mailing list