For review: PEP 308 - If-then-else expression
James J. Besemer
jb at cascade-sys.com
Sun Feb 9 11:34:16 CET 2003
Roy Smith wrote:
> I guess deep down, my real objection to all this is that it blurs the
> line between statements and expressions. In some languages (lisp, for
> example) there is no such distinction, and everything returns a value.
> But in Python, there is a distinction. So is "if" a statement or an
> expression? With this PEP, the answer becomes, "it depends", which I
> think is a bad answer.
"if" is a keyword. So is "for". Neither is a "statement" in and of
Even without PEP308 they are presently used both to start a statement and as
elements within an expression. Thus the precise meaning of any particular
keyword (although very similar in all cases) can only be determined by
examining the surrounding context.
James J. Besemer 503-280-0838 voice
2727 NE Skidmore St. 503-280-0375 fax
Portland, Oregon 97211-6557 mailto:jb at cascade-sys.com
More information about the Python-list