Re: Calling a class instance like a function

2009-02-19 Thread Bruno Desthuilliers
Uberman a écrit : I'm wondering if there's a way to invoke a "function" operator on a Python class instance. For example, given a class instance: myClass = MyClass() I want to call that instance like a function, with an argument value: myClass(5.0) I can override the "()" ope

Re: Calling a class instance like a function

2009-02-18 Thread Uberman
Thank you very much, Filip!! :) Filip Gruszczyński wrote: > __call__ > > 2009/2/19 Uberman : >> I'm wondering if there's a way to invoke a "function" operator on a Python >> class instance. For example, given a class instance: >> >>myClass = MyClass() >> >> I want to call that instance

Re: Calling a class instance like a function

2009-02-18 Thread Filip Gruszczyński
__call__ 2009/2/19 Uberman : > I'm wondering if there's a way to invoke a "function" operator on a Python > class instance. For example, given a class instance: > >myClass = MyClass() > > I want to call that instance like a function, with an argument value: > >myClass(5.0) > > I c

Calling a class instance like a function

2009-02-18 Thread Uberman
I'm wondering if there's a way to invoke a "function" operator on a Python class instance. For example, given a class instance: myClass = MyClass() I want to call that instance like a function, with an argument value: myClass(5.0) I can override the "()" operator in C++, so I'm