[Edu-sig] Properties use case

Michael Tobis mtobis at gmail.com
Sat Mar 18 23:39:51 CET 2006


The following, modulo a pronoun shift were exactly the words I was
sitting down to type.

> I am not designing a programming language, I am designing an application.

That is why, to me, the advice offerred to date seems quite far off the mark.

> And bingo - for that application I need them to be more objects than values.

So, is there a problem with wrapping them thus:

###
class mcx(object):

  def  __init__(self,val):
     self.val = complex(val)

  def __add__(self,other):
      """ and similarly for most other special methods """
     return self.val.__add__(other)
###

I think Arthur would duckishly call this a mutable complex type and
others would more formally call it an object containing a reference to
an immutable complex type and we could all live happily ever after. If
I am right then the vast verbiage expended on this thread so far
deflates into exactly nothing.

If this is inadequate for anyone, what exactly is the problem?

mt


More information about the Edu-sig mailing list