metaclasses: timestamping instances

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Sep 3 20:43:29 EDT 2007


En Mon, 03 Sep 2007 07:39:05 -0300, km <srikrishnamohan at gmail.com>  
escribi�:

> But why does it show  varied difference in the time  between a and b
> instance creations when __metaclass__ hook is used and when not used in
> class Y ? I dont understand that point !

What do you expect from a._created, b._created, and its difference?
You reset Meta.start each time - so _created measures the time between  
creation of two consecutive instances (minus a small delay because of the  
*two* calls to time.time())
And obviously the elapsed time until the second instance is created is  
larger, due to the intervening print statement.

-- 
Gabriel Genellina




More information about the Python-list mailing list