how to write function that returns function
Fernando Pérez
fperez528 at yahoo.com
Fri May 17 18:33:23 EDT 2002
More information about the Python-list mailing list
Fri May 17 18:33:23 EDT 2002
- Previous message (by thread): how to write function that returns function
- Next message (by thread): how to write function that returns function
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Paul Graham wrote:
> but it is considered ugly, and the canonical way to
> do this seems to be by defining a class:
>
> class foo:
> def __init__(self, n):
> self.n = n
>
> def __call__(self, i):
> self.n += i
> return self.n
^^^
I think you mean:
return self
Cheers,
f.
- Previous message (by thread): how to write function that returns function
- Next message (by thread): how to write function that returns function
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list