Issue 940522: misbehaviour with map / lambda / isdigit() (original ) (raw ) Issue940522
Created on 2004-04-23 06:32 by drearyslig , last changed 2022-04-11 14:56 by admin . This issue is now closed .
Files
File name
Uploaded
Description
Edit
bug.txt
drearyslig,2004-04-23 06:32
Simple code to reproduce bug
Messages (3)
msg20571 - (view)
Author: dreary (drearyslig)
Date: 2004-04-23 06:32
This code causes "0".isdigit() to incorrectly report False. Also apparent on RHEL with Python 2.2.3.
msg20572 - (view)
Author: Bastian Kleineidam (calvin)
Date: 2004-04-23 12:28
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() ]
msg20573 - (view)
Author: Tim Peters (tim.peters) *
Date: 2004-04-23 15:04
Logged In: YES user_id=31435 Closed as NotABug. As Calvin said, it's working correctly; the and/or trick is delicate.
History
Date
User
Action
Args
2022-04-11 14:56:03
admin
set
github: 40180
2004-04-23 06:32:15
drearyslig
create