On Mon, 03 Aug 2009 16:38:43 +0200, Jean-Michel Pichavant wrote:

> So what's the purpose of making
> 
>>from Module import factory as a
>>from Module import factory as b
> 
> return 2 different objects ? If I had to write this code I would expect
> 'a is b' to return 'True'.
> 
> This is no "don't do that" answer, it's a sincere question: what  is the
> benefit of your /new/ syntax ?


Consider it "properties for modules":

a = obj.factory
b = obj.factory

doesn't promise that a is b, because factory might be a property that 
returns a new object each time.

Actually, this behaviour pre-dates properties. If obj has a __getattr__ 
or __getattribute__ method, then it could do the same thing.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to