syntax question - if 1:print 'a';else:print 'b'
fredrik at pythonware.com
Thu Oct 27 00:24:01 CEST 2005
Gregory Piñero wrote:
> Any idea why I can't say:
> if 1:print 'a';else:print 'b'
> all in one line like that?
because ";" can only be used to separate simple statements, not
the different parts in a compound statement.
see the grammar for details:
(look for "compound_stmt", "suite", "statement", etc)
More information about the Python-list