Let's Talk About Lambda Functions!

John Roth johnroth at ameritech.net
Mon Aug 5 08:09:46 EDT 2002


"Greg Ewing" <see_reply_address at something.invalid> wrote in message
news:3D4DFF0A.7020700 at something.invalid...
> John Roth wrote:
>
> >
> > In other words,
> >
> > class foo:
> >     bar = (
> >         def (x, y):
> >             print x
> >             print y
> >         )
> >
> > makes the anonymous function a method because it's
> > bound to a name in the class namespace?
>
>
> Closer, but the distinction is actually made even
> later than that. As long as it's sitting in the class
> namespace, it's still just an ordinary function.
> You can see this by looking at foo.__dict__["bar"].
> You'll see that it's just a plain function taking
> two arguments. [See footnote.]

You're right, of course. Someone else pointed that out
a couple of days ago.

John Roth






More information about the Python-list mailing list