This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author meador.inge
Recipients Michael.Smith, jcea, meador.inge
Date 2012-07-20.02:15:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1342750513.62.0.441734578376.issue15400@psf.upfronthosting.co.za>
In-reply-to
Content
It could be argued that this is a bug fix for 2.7.  I find the current behavior odd at best since 'int' already accepts 'long' objects, but not the string representation of a 'long' object:

>>> sys.maxint
9223372036854775807
>>> sys.maxint + 1
9223372036854775808L
>>> int(sys.maxint)
9223372036854775807
>>> int(sys.maxint + 1)
9223372036854775808L
>>> int(9223372036854775807)
9223372036854775807
>>> int('9223372036854775807')
9223372036854775807
>>> int(9223372036854775808L)
9223372036854775808L
>>> int('9223372036854775808L')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '9223372036854775808L'
>>> long('9223372036854775808L')
9223372036854775808L
>>> int(1)
1
>>> int('1L')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '1L'

Let's discuss this a bit before closing it.  What do others think?
History
Date User Action Args
2012-07-20 02:15:13meador.ingesetrecipients: + meador.inge, jcea, Michael.Smith
2012-07-20 02:15:13meador.ingesetmessageid: <1342750513.62.0.441734578376.issue15400@psf.upfronthosting.co.za>
2012-07-20 02:15:13meador.ingelinkissue15400 messages
2012-07-20 02:15:12meador.ingecreate