map/filter/reduce/lambda opinions and background unscientific mini-survey

Dan Sommers me at
Wed Jul 6 22:30:52 CEST 2005

On Wed, 6 Jul 2005 20:42:51 +0200,
Stian Søiland <stian at> wrote:

> I'm all for it. I would even be tempted of changing def to function,
> but it would look stupid in:

>     class A:
>         function make_my_day(self):
>             return "Your day"
>     a = A()

> since a.make_my_day() is really a method, not a standalone function. 
> We could use "function" instead of "lambda" though =)

So use "method" instead, which has the added advantage of implicity
declaring an extra argument named "this":

    class A:
        method __init__():
            this.x = 0
        method make_my_day(foo):
            this.x += foo

there-aren't-enough-winks-in-the-universe'ly yours,

Dan Sommers

More information about the Python-list mailing list