[Tutor] error in docs regarding map
Christopher Smith
csmith@blakeschool.org
Wed, 06 Mar 2002 22:23:22 -0600
OK, pretty soon I'll just trust my own judgement, but would you agree that
the docs obtained when typing help(filter) are wrong--they say that the
result of filter is a list; I think it should say that the result is a
sequence (if a string is filtered, a string is returned and if a list is
filtered, a list is returned). If this is an error, should I file this at
the SourceForge?
Python 2.2 (#126, Jan 15 2002, 21:27:18) [CW CARBON GUSI2 THREADS GC]
Type "copyright", "credits" or "license" for more information.
MacPython IDE 1.0.1
>>> s='nlK'
>>> l=list(s)
>>> filter(lambda x:x.isupper(),s)
'K' #<-----------------------------a string, not a list
>>> filter(lambda x:x.isupper(),l)
['K']
>>> map(lambda x:x.upper(),s)
['N', 'L', 'K']
>>> map(lambda x:x.upper(),l)
['N', 'L', 'K']
>>>
BTW, are the docs obtained when typing help(filter) or help(map) hardcoded
into Python's source code?
/c