Why we will use obj$func() often

Fredrik Lundh fredrik at pythonware.com
Fri Apr 23 15:03:43 EDT 2004


Mark Hahn wrote:
> (by the way, Python cannot do this)

sure can, if you use mutable integers.

> # tested example
> def getFunc():
>     counter = 0
>     def count():
>             &counter += 1
>             print &counter
>     return count

</F>







More information about the Python-list mailing list