Re: keeping a ref to a non-member function in a class

2005-08-17 Thread Peter Otten
Gregory Bond wrote: Thanks Peter, that's a big help. You're welcome. I can solve my problem now, but I'm chasing this further in the name of education, because it seems there is some deep magic happening here that I don't understand. Python resorts to deep magic only when it's inevitable,

keeping a ref to a non-member function in a class

2005-08-16 Thread Gregory Bond
I'm building a class hierarchy that needs to keep as a class variable a reference to a (non-member) function, so that different subclasses can use different generator functions. But it seems Python is treating the function as a member function because the reference to it is in class scope

Re: keeping a ref to a non-member function in a class

2005-08-16 Thread Peter Otten
Gregory Bond wrote: I'm building a class hierarchy that needs to keep as a class variable a reference to a (non-member) function, so that different subclasses can use different generator functions. But it seems Python is treating the function as a member function because the reference to it

Re: keeping a ref to a non-member function in a class

2005-08-16 Thread Gregory Bond
Peter Otten wrote: You are on the right track with staticmethod, but you have to apply it to fn: ... fn = staticmethod(foo) Thanks Peter, that's a big help. I can solve my problem now, but I'm chasing this further in the name of education, because it seems there is some deep magic