Combining colon statements on one line?
steven.bethard at gmail.com
Fri Jul 16 19:03:15 CEST 2004
Dave Blackington <metapsyc at yahoo.com> wrote in message news:<mailman.473.1089954583.5135.python-list at python.org>...
> '972' '006'
> I have two dates without the millenium included.
> Using basic 'if' 'else' communication, this, it seems
> to me would require 4 lines of python to add the
> correct millenium.
abbrYear < PIVOT_YEAR and 2000 or 1000
and's and or's will usually do the trick unless one of the result
values evaluates to false, e.g.
abbrYear < PIVOT_YEAR and 0 or 1000
would be bad because it would alway give you 1000. But in your case,
I think yo're okay.
More information about the Python-list