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

Gerrit Holl gerrit@nl.linux.org
Fri, 3 Mar 2000 13:25:43 +0100


<quote name="Jason Stokes" date="952100675" email="jstok@bluedog.apana.org.au">
> 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?

"print" is not a function, print is a statement.
</quote>

regards,
Gerrit.

-- 
Plies korekt enie bet ingglisj joe encauntur in mai imil mesusj!
-----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
Version: 3.12
GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE?
Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y
-----END GEEK CODE BLOCK-----