else on the same line - howto
Gerrit Holl
gerrit at nl.linux.org
Wed Oct 15 07:17:56 EDT 2003
Helmut Jarausch wrote:
> Sorry for this trivial question
>
> Since Python lacks conditional expression
>
> like
>
> k+= (dy >= 0 ? 1 : -1)
See PEP 308 and google for PEP 308 (on Google groups) for background
information.
> I would like to write
> if dy >= 0 : k+= 1; else: k-= 1
You can't.
> instead of
> if dy >= 0 : k+= 1
> else : k-= 1
Why do you want to obscure you're own code?
Gerrit Holl.
--
40. He may sell field, garden, and house to a merchant (royal agents)
or to any other public official, the buyer holding field, house, and
garden for its usufruct.
-- 1780 BC, Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
http://people.nl.linux.org/~gerrit/
Kom in verzet tegen dit kabinet:
http://www.sp.nl/
More information about the Python-list
mailing list