mktime() like function to produce GMT?

Fredrik Lundh fredrik at pythonware.com
Thu May 6 10:14:52 EDT 1999


Mark Nottingham <mnot at pobox.com> wrote:
> I'm sure there are prettier, faster ways to do this to the code  (BTW,
> assert isn't clearly documented in the reference, AFAIK):

http://www.python.org/doc/current/ref/assert.html

    "Assert statements are a convenient way to insert
    debugging assertions into a program"

    "The current code generator emits no code for an
    assert statement when optimization is requested at
    compile time"

in other words, this is not a great way to
use assert...

>     try:
>         assert year >= EPOCH
>     except AssertionError:
>         if year < 69:
>             year = year + 2000
>         else:
>             year = year + 1900

you may wish to change that to something more
similar to:

    if year < 70:
        year = year + 2000
    elif year < 100:
        year = year + 1900
    assert year >= EPOCH

</F>





More information about the Python-list mailing list