Re: how to cause a request for a missing class attribute cause its calculation

2010-05-19 Thread John Posner
On 5/18/2010 4:54 PM, Chris Rebert wrote: snip Suggested reading: http://docs.python.org/library/functions.html#property I've placed a revision to this official *property* documentation at: http://wiki.python.org/moin/AlternativeDescriptionOfProperty There's also a gentle (I hope) intro

how to cause a request for a missing class attribute cause its calculation

2010-05-18 Thread Vincent Davis
Lets say I have class foo(object): def __init__(self, x, y): self.x=x self.y=y def xplusy(self): self.xy = x+y inst = foo(1,2) inst.xy # no value, but I what this to cause the calculation of inst.xy I don't what to have self.xy calculated before it is called.

Re: how to cause a request for a missing class attribute cause its calculation

2010-05-18 Thread Chris Rebert
On Tue, May 18, 2010 at 1:39 PM, Vincent Davis vinc...@vincentdavis.net wrote: Lets say I have class foo(object):     def __init__(self, x, y):         self.x=x         self.y=y     def xplusy(self):         self.xy = x+y inst = foo(1,2) inst.xy   # no value, but I what this to cause the

Re: how to cause a request for a missing class attribute cause its calculation

2010-05-18 Thread Ethan Furman
Vincent Davis wrote: Lets say I have class foo(object): def __init__(self, x, y): self.x=x self.y=y def xplusy(self): self.xy = x+y ^ this needs to be self.x + self.y inst = foo(1,2) inst.xy # no value, but I what this to cause the

Re: how to cause a request for a missing class attribute cause its calculation

2010-05-18 Thread Ethan Furman
Ethan Furman wrote: Vincent Davis wrote: Lets say I have class foo(object): def __init__(self, x, y): self.x=x self.y=y def xplusy(self): self.xy = x+y ^ this needs to be self.x + self.y inst = foo(1,2) inst.xy # no value, but I what