Scott David Daniels wrote: >Arthur wrote: > > >>My studies on the subject of subclassing the complex type have been quickly >>abandoned - it becoming clear that the fact the .real and .imag are read-only >>defeats the ideas I had for it. >> >> >Ahh: complex is (as are bool, int, long, string, and unicode) immutable. >Changing such types to be mutable is "nasty" -- reuse of an immutable is >done by referring to the same object, while reuse of an immutable needs >a copy. > Getting one's arms around all the practical implications of these issues related to mutable, immutable - understanding when one should want to retain object identity, and when one should want to break it, the full implications of these decisions, howto implement one's intentions - is, on one hand - I find, fundamental to getting things to actually happen in Python as one intends, and on the other hand , challenging. It is the fundamental reason I chafe a bit when Python is described as "easy".
Because I have had trouble with these issues from day one, it ain't day one anymore, I still have some troubles with them and I prefer to think that it is challenging over thinking that I am dumb. I am going down the road of the mutable complex number with my eyes (half) open precisely because I want the ability to change the value of a complex number object (and it's subclasses), without changing the identity of the object. Is that so wrong ;) >If you define a class named PyGeoTriangle, you create new instances with >PyGeoTriangle(<some args>). > The connection of what you are saying here to the issue on which I am particularly confused is - well - confusing, to me. In Arthur's head there is the numeric type "float", and there is the function float() - both built in. And in Arthur's head, while functions are first class objects in Python they are objects of a different nature than type in the sense of numeric type. So in some sense what I am not grasping is how class/type unification can be inclusive of verb - i.e, float(1) - and noun - i.e., type(1.) - unification - which in Arthur's head, is something else again. Art _______________________________________________ Edu-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/edu-sig
