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.

Title: len(str(x)) in is not Python 2.3 compatible
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: ncoghlan, rhettinger, tim.peters
Priority: normal Keywords:

Created on 2004-09-29 23:36 by ncoghlan, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg22570 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2004-09-29 23:36
One of the stated goals of is to remain 2.3

This is not currently the case, as the len(str(x))
trick I used to determine the 'number of digits in an
integer' gives the wrong answer for long integers in
Python 2.3 (there is an extra 'L' on the end).
msg22571 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-09-30 00:34
Logged In: YES 

Check again.
str(123L) automatically drops the L
repr(123L) keeps it.

I had run the decimal tests on Py2.3 without exception.

So, please reverify your claim.  If valid, show an example
where it doesn't work, add that example as a test case, and
submit a patch.
msg22572 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2004-09-30 01:04
Logged In: YES 

Indeed, please give a specific example, and point out exactly 
what in that example you think should change, and how you 
think it should change.  Else I've got no idea what you're 
talking about either.

>>> import decimal
>>> a = decimal.Decimal(3)
>>> str(a)
>>> len(str(a))

That's under current CVS Python, and I see nothing 
objectionable in it.  I'd bet several pennies it works the same 
under 2.3.4.
msg22573 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2004-09-30 06:09
Logged In: YES 

Gah, you're right. Sorry - I was doing something else in Py
2.3, and had the L's showing up. And then I overreacted and
thought I'd made the same mistake in, and created
the bug report to make sure I didn't forget to go back and

However, I was using repr() for what I was doing (whereas uses str()). False alarm. Nothing to see here.
Move along. . .
Date User Action Args
2022-04-11 14:56:07adminsetgithub: 40964
2004-09-29 23:36:21ncoghlancreate