For review: PEP 308 - If-then-else expression

Andrew Koenig ark at research.att.com
Sun Feb 9 23:05:59 EST 2003


holger> But 

holger>     <expr>

holger> is a perfectly valid statement. e.g.

holger>     somelist.append(1)

holger> so

holger>     if something: 

holger> would leave the parser having to look ahead of what this means.

I'm sorry, but I don't understand what you mean by ``having to look
ahead of what this means.''

If the "if" in "if something:" is the first token in its statement,
then what follows the : is a suite; otherwise it's an expression.






More information about the Python-list mailing list