Re: can a subclass method determine if called by superclass?

2012-01-05 Thread Jean-Michel Pichavant
Peter wrote: Situation: I am subclassing a class which has methods that call other class methods (and without reading the code of the superclass I am discovering these by trial and error as I build the subclass - this is probably why I may have approached the problem from the wrong viewpoint

Re: can a subclass method determine if called by superclass?

2012-01-05 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Peter wrote: Situation: I am subclassing a class which has methods that call other class methods (and without reading the code of the superclass I am discovering these by trial and error as I build the subclass - this is probably why I may have approached the

can a subclass method determine if called by superclass?

2012-01-04 Thread Peter
Situation: I am subclassing a class which has methods that call other class methods (and without reading the code of the superclass I am discovering these by trial and error as I build the subclass - this is probably why I may have approached the problem from the wrong viewpoint :-)). Problem:

Re: can a subclass method determine if called by superclass?

2012-01-04 Thread Ian Kelly
On Wed, Jan 4, 2012 at 3:42 PM, Peter peter.milli...@gmail.com wrote: Situation: I am subclassing a class which has methods that call other class methods (and without reading the code of the superclass I am discovering these by trial and error as I build the subclass - this is probably why I

Re: can a subclass method determine if called by superclass?

2012-01-04 Thread Peter
On Jan 5, 10:09 am, Ian Kelly ian.g.ke...@gmail.com wrote: Well, you could get the previous stack level using traceback.extract_stack() and check the filename.  But it sounds like what you actually have are two different methods -- one that is used by the superclass, and one that only the

Re: can a subclass method determine if called by superclass?

2012-01-04 Thread Steven D'Aprano
On Wed, 04 Jan 2012 15:37:55 -0800, Peter wrote: I am trying to create a subclass with slightly different functionality and use it with an existing code base i.e. there is already one or more modules that instantiate the current superclass and I want to just drop in this new class to replace