[Edu-sig] Properties use case

Laura Creighton lac at strakt.com
Sat Mar 18 21:01:17 CET 2006

In a message of Sat, 18 Mar 2006 14:11:03 EST, Arthur writes:
>> >-----Original Message-----
>> >From: edu-sig-bounces at python.org 
>> >[mailto:edu-sig-bounces at python.org] On Behalf Of Arthur
>> >Sent: Saturday, March 18, 2006 1:39 PM
>> >To: 'Scott David Daniels'; edu-sig at python.org
>>>I don't understand, really, the distinction 
>> >between a vector expressed as a list and a vector expressed 
>> >as a tuple, from the concept of a complex number in mutable 
>> >form, and one in immutable form. 
>> >
>> >If you feel like trying to help...
>Put another way, if I take the PyPy implementation of the complex primiti
>and comment out the 2 property lines that restrict the write to real and
>imag - and instead of calling it a primitive I call it a class.  And I use
>the class as such - where have I gone wrong?

I'm confused too.

It sounds to me that you want to invent your own type.  Does your type
have any relationship to the complex numbers that we know and love, or
do you just want a type that has 2 parts?  

In particular, check out:

Do you want this 

a + ib = r (cos(t) + i sin(t))

to be true for your type as well?  I think so.

I'm worried that when you start mutating the type -- as opposed to
simply assigning new values to it -- you can create a state where
this is _not_ true.  Am I wrong?


More information about the Edu-sig mailing list