Message165895
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? |
|
Date |
User |
Action |
Args |
2012-07-20 02:15:13 | meador.inge | set | recipients:
+ meador.inge, jcea, Michael.Smith |
2012-07-20 02:15:13 | meador.inge | set | messageid: <1342750513.62.0.441734578376.issue15400@psf.upfronthosting.co.za> |
2012-07-20 02:15:13 | meador.inge | link | issue15400 messages |
2012-07-20 02:15:12 | meador.inge | create | |
|