Python 2.3: int() ?

logistix logistix at zworg.com
Fri Jan 17 16:55:26 EST 2003


Carsten Gaebler <news at snakefarm.org> wrote in message news:<b09761$a32$1 at news.schlund.de>...
> Hi there,
> 
> I just read the 2.3 'highlights' page on python org, and I'm a bit 
> confused: it says '# int() - this can now return a long when converting 
> a string with many digits, rather than raising OverflowError.'
> 
> What does 'can' mean here? Can I switch between returning a long or 
> raising an exception?
> 
> cg.
You can always do this yourself

def Int(notAnInt):
    retVal = int(notAnInt)
    assert isinstance(retVal,int), "integer conversion overflow."
    return retVal




More information about the Python-list mailing list