python an sqlite objects

Bryan Olson fakeaddress at nowhere.org
Thu Dec 4 14:56:10 EST 2008


skip at pobox.com wrote:
>     >> # Ensure that we're running Python 3 or later.
>     >> import sys
>     >> assert int(sys.version.split()[0].split('.')[0]) >= 3
>     >> # If there's a better way to chek, please tell.
[...]

> Why split at all?  Just use sys.version_info:
> 
>     >>> import sys
>     >>> assert sys.version_info[0] > 2, sys.version_info
>     Traceback (most recent call last):
>       File "<stdin>", line 1, in ?
>     AssertionError: (2, 4, 5, 'final', 0)

Thanks. Yes, that's better.

To verify that the running version of Python is 3 or higher,

    import sys
    assert sys.version_info[0] >= 3


-- 
--Bryan



More information about the Python-list mailing list