[Tutor] Can't use builtin function objects like user defined objects

Jason Stokes jstok@bluedog.apana.org.au
Fri, 3 Mar 2000 17:24:35 +1100


Consider the following:

>> testtext = ['Four', 'lines', 'of', 'text',]
>> def myprint(item):
...    print item
...
>>> result = map(print, testtext)
  File "<string>", line 1
     map(print, testtext)
             ^
 SyntaxError: invalid syntax
>>> result = map(myprint, testtext)
Four
lines
of
text
>>>

Clearly I can't use "print" the same way I use "myprint".  Why?