[ python-Bugs-940522 ] misbehaviour with map / lambda / isdigit()

SourceForge.net noreply at sourceforge.net
Fri Apr 23 08:28:45 EDT 2004


Bugs item #940522, was opened at 2004-04-23 08:32
Message generated for change (Comment added) made by calvin
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=940522&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: dreary (drearyslig)
Assigned to: Nobody/Anonymous (nobody)
Summary: misbehaviour with map / lambda / isdigit()

Initial Comment:
This code causes "0".isdigit() to incorrectly report
False. Also apparent on RHEL with Python 2.2.3.

----------------------------------------------------------------------

Comment By: Wummel (calvin)
Date: 2004-04-23 14:28

Message:
Logged In: YES 
user_id=9205

This is not a bug: the expression ("0".isdigit() and
int("0")) is False, not True as you expected.
What you can do is:
strlist = ['0', '1', '42', 'foo']
intlist = [ int(x) for x in strlist if x.isdigit() ]

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=940522&group_id=5470



More information about the Python-bugs-list mailing list