How to create functors?

Ned Deily nad at acm.org
Tue Aug 18 23:00:04 CEST 2009


In article 
<5834f36f-b172-4e76-ad90-7056e7097cdd at o6g2000yqj.googlegroups.com>,
 Robert Dailey <rcdailey at gmail.com> wrote:
> I see what you're saying now. However, why am I able to use print as a
> function in general-purpose code in my Python 2.6 script, like so:
> 
> def SomeFunction():
>    print( "Hello World" )

For the same reason you can do this:

>>> x = ( "Hello World" )
>>> type(x)
<type 'str'>

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list