Arthur wrote:
... But if we trace back the thread we will see that the bottom line question
that I was struggling with at the beginning was precisely the question of
what *makes* a primitive type such. Obviously something much deeper than the
fact that it is coded in C.
Well, if it hadn't
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Arthur
Sent: Saturday, March 18, 2006 1:39 PM
To: 'Scott David Daniels'; edu-sig@python.org
I don't understand, really, the distinction
between a vector expressed as a list and a vector expressed
In a message of Sat, 18 Mar 2006 14:11:03 EST, Arthur writes:
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Arthur
Sent: Saturday, March 18, 2006 1:39 PM
To: 'Scott David Daniels'; edu-sig@python.org
I don't understand, really, the distinction
-Original Message-
From: Laura Creighton [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 18, 2006 3:01 PM
To: Arthur
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
Arthur wrote:
...
Isn't the creation of any class the creation of one's own type? Now what am
I missing now?
Ahh, I thought we were talking about language primitives. The range of
behavior for non-primitives is larger. For example, a Vertex in 3-space
for a polyhedron might have mutable
Hello Scott,
In C++ we have a saying for value types, such as complex numbers: Do
as the ints do. The complex class in C++ is also immutable. I have
never seen a need for mutable numeric, scalar quantities since I
began scientific programming 30 years ago. Just a perspective.
Friday, March 17,
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Scott David Daniels
Arthur wrote:
...
Isn't the creation of any class the creation of one's own
type? Now
what am I missing now?
Ahh, I thought we were talking about language
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
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Arthur
What was creepy - *I thought* - was the concept of
mutable complex number as a type, in the same sense that any
class is a type.
Just so that I am not accused of being disingenuous.
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael Tobis
objects than values.
So, is there a problem with wrapping them thus:
###
class mcx(object):
def __init__(self,val):
self.val = complex(val)
def
-Original Message-
From: Michael Tobis [mailto:[EMAIL PROTECTED]
So unless there's a performance issue I can't see what you
lose by wrapping the complex number.
My last friend oh well.
Because it didn't *feel* yet that I couldn't come up with something better,
that I was at
-Original Message-
From: Arthur [mailto:[EMAIL PROTECTED]
Because it didn't *feel* yet that I couldn't come up with
something better, that I was at the end of the road. No
question, it was workable - and if I was being paid to do
this work by the hour it would have been
Well, if you are sacrificing performance, what is wrong with wrapping
the complex number in a pure python class with all the magic methods
overridden?
I share your objectives and agree that Python provides a platform for
addressing them. See my article at
-Original Message-
From: Michael Tobias [mailto:[EMAIL PROTECTED]
I would be happy to discuss the topic, but this requires
that I approach the design with due skepticism. If you don't
care to explain your needs you can't expect many useful
answers, though I think it's
On Saturday 18 March 2006 16:39, Michael Tobis wrote:
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
This reminds me of a question I have with new-style classes.
I just asked basically this question on c.l.p, and Alex Martelli has
answered, quite helpfully. See topic
can't rebind magic methods'
Michael Tobis
___
Edu-sig mailing list
16 matches
Mail list logo