syntax question - if 1:print 'a';else:print 'b'

Gregory Piñero gregpinero at gmail.com
Thu Oct 27 10:57:51 EDT 2005


So much for writing my whole program on one line :-(

j/k

-Greg

On 10/26/05, Fredrik Lundh <fredrik at pythonware.com> wrote:
>
> 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:
>
> http://docs.python.org/ref/grammar.txt
>
> (look for "compound_stmt", "suite", "statement", etc)
>
> </F>
>
>
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>


--
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com <http://www.blendedtechnologies.com>)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20051027/fbae4e82/attachment.html>


More information about the Python-list mailing list