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

Dan Sommers me at privacy.net
Wed Jul 6 16:30:52 EDT 2005


On Wed, 6 Jul 2005 20:42:51 +0200,
Stian Søiland <stian at soiland.no> 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

-- 
Dan Sommers
<http://www.tombstonezero.net/dan/>



More information about the Python-list mailing list