What does "first class" mean?
Neel Krishnaswami
neelk at brick.cswv.com
Fri Apr 28 19:44:20 EDT 2000
Tom Loredo <loredo at spacenet.tn.cornell.edu> wrote:
>
> I've often seen reference here (and on the Ruby page) to Python's
> treatment of functions and methods as "first class objects." What
> does this mean?
It means that functions and methods are values just like like lists
and numbers. Basically, you can write functions that accept functions
as arguments, return them as values, create new ones and bind them to
variables just like any other object.
In Pascal or C, for example, you can't write a procedure that creates
a function and returns it to its callers, whereas in Scheme or Python
this is trivial.
Neel
More information about the Python-list
mailing list