[Python] How can a function find the function that called it?

John Nagle nagle at animats.com
Fri Dec 24 13:26:40 EST 2010


On 12/24/2010 8:51 AM, Chris Gonnerman wrote:
> On 12/24/2010 10:24 AM, kj wrote:
>> I want to implement a frozen and ordered dict.
>>
>> I thought I'd implement it as a subclass of collections.OrderedDict
>> that prohibits all modifications to the dictionary after it has
>> been initialized.

     That's actually a fairly common question - is an object in
initialization, or has it been fully created?  It would be useful
if Python had some standard way to check if initialization
has completed.  Sometimes a parent class needs to know if
initialization of the entire object has completed.  This typically
comes up with classes that define "__setattr__" and are then
subclassed.


				John Nagle



More information about the Python-list mailing list