[Python-Dev] properties on modules?

Ben Laurie ben@algroup.co.uk
Mon, 13 Jan 2003 19:13:49 +0000


Brian Quinlan wrote:
>>>It would be really cool if this worked:
>>>
>>>import time
>>>now = property(lambda m: time.time())
>>>
>>>Obviously a silly example but I hope the idea is clear.  Is there a
>>>reason this couldn't be made to work?
>>
>>The idea is not clear to me at all.  Why can't you say
>>
>>now = lambda: time.time()
> 
> 
> Presumably, he would prefer this syntax:
> 
> start = time.now
> 
> to:
> 
> start = time.now()
> 
> The .NET framework implements "now" as a property rather than a function
> and I find it distasteful for some reason. 

Presumably because inutuition says properties should hold still, not 
wiggle about of their own accord.

Cheers,

Ben.

-- 
http://www.apache-ssl.org/ben.html       http://www.thebunker.net/

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff