Set run vars with each call

Ben Finney ben+python at
Tue Jul 12 17:36:49 EDT 2011

Gnarlodious <gnarlodious at> writes:

> OK, [the ‘__init__’ method] sets a value at init time. But is there a
> similar built-in to run whenever the class instance is called?

You can write a ‘__call__’ method which will be called when the instance
is called.

But I suspect that's still not what you're asking.

Maybe it will be quicker to ask: What is it you want to achieve?

 \      “Compulsory unification of opinion achieves only the unanimity |
  `\        of the graveyard.” —Justice Roberts in 319 U.S. 624 (1943) |
_o__)                                                                  |
Ben Finney

More information about the Python-list mailing list