Why no 'elif' in try/except?
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Mon Jun 4 17:40:28 EDT 2001
Mon, 4 Jun 2001 15:36:35 -0400, D-Man <dsh8290 at rit.edu> pisze:
> I think it is also related to Python's block structure. If it was
> spelled "else if" in the same way C/C++/Java spell it, then your code
> would have to look like
>
> if <expr> :
> <statements>
> else if <expr> :
> <statements>
> else if <expr> :
'else if' would mean exactly what 'elif' means today - it's still
a special rule, but not an additional keyword. Currently a colon is
always present after 'else', so there is no ambiguity. Double keywords
are used anyway in other places, e.g. 'not in' and 'is not'.
if <expr>:
<statements>
else if <expr>:
<statements>
else if <expr>:
<statements>
else if <expr>:
<statements>
else:
<statements>
--
__("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZASTĘPCZA
QRCZAK
More information about the Python-list
mailing list