Re: [Edu-sig] Properties use case

2006-04-06 Thread Dethe Elza
The last thing I want is to start up this thread again, but I have not been paying attention to edu-sig for awhile and when I came back I found some things I need to address. Yes, I know, I read that. I'm not questioning that you know this. You asked what problems from a CS viewpoint there

Re: [Edu-sig] Properties use case

2006-04-06 Thread ajsiegel
- Original Message - From: Dethe Elza [EMAIL PROTECTED] Arthur to Kirby: Are you a CS type? If so, speak directly. If not, why do you feel compelled to speak on their behalf. Sorry if I'm mis-reading that, but it looks to me like shut up, which I find offensive, even if

Re: [Edu-sig] Properties use case

2006-04-06 Thread kirby urner
I appreciate your communication here very much. Thnks, Art Good work, both of you. I look forward to archived v-lists (video lists). I don't know how they'd work exactly, but the bandwidth would be a lot higher. People who're already on the same page could get by with edu-sig type

Re: [Edu-sig] Properties use case

2006-03-25 Thread Laura Creighton
In a message of Sat, 25 Mar 2006 03:02:31 EST, Arthur writes: It doesn't matter to me any more than whether my tax calculations are consistently correct were my class the one you described a few posts back . I think I should perhaps appreciate that Kirby is the only one talking straight to me.

Re: [Edu-sig] Properties use case

2006-03-25 Thread Arthur
-Original Message- From: Laura Creighton [mailto:[EMAIL PROTECTED] Sent: Saturday, March 25, 2006 7:16 AM To: Arthur Ok, so it does matter. Are you locking your complex number before modifying it? Just to generalize the issue, so that I know, realy, what we are talking about,

Re: [Edu-sig] Properties use case

2006-03-25 Thread Chuck Allison
I think they are going on about a very fundamental CS issue: mutable objects are not thread-safe. If threads are not an issue, then this has all been hot air, but it came up, IIRC, because the discussion mentioned the mutable vs. immutable issue, and this always leads one to concurrency nowadays,

Re: [Edu-sig] Properties use case

2006-03-25 Thread Arthur
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Tobis Sent: Saturday, March 25, 2006 10:21 AM To: edu-sig@python.org Subject: Re: [Edu-sig] Properties use case Arthur (addressing you directly) does your code use any threading

Re: [Edu-sig] Properties use case

2006-03-24 Thread Laura Creighton
In a message of Thu, 23 Mar 2006 10:49:41 CST, Michael Tobis writes: Then it is the language implementor's headache to make the locking mec hanism work. from threading import Lock generally works for me. Arthur is not implementing a general purpose thread-safe language, so like him I continue

Re: [Edu-sig] Properties use case

2006-03-23 Thread Grégoire Dooms
Arthur wrote: -Original Message- From: Laura Creighton [mailto:[EMAIL PROTECTED] And I think he will like tens of thousands of threads, too, though if these just means tens of thousands of chances to modify only part of your complex number, when you wanted an

Re: [Edu-sig] Properties use case

2006-03-23 Thread Laura Creighton
In a message of Thu, 23 Mar 2006 16:24:39 +0100, Grégoire Dooms writes: Arthur wrote: -Original Message- From: Laura Creighton [mailto:[EMAIL PROTECTED] And I think he will like tens of thousands of threads, too, though if these just means tens of thousands of

Re: [Edu-sig] Properties use case

2006-03-23 Thread Michael Tobis
Then it is the language implementor's headache to make the locking mechanism work. from threading import Lock generally works for me. Arthur is not implementing a general purpose thread-safe language, so like him I continue to be confused as to the relevance of this conversation to his

Re: [Edu-sig] Properties use case

2006-03-23 Thread John Zelle
Since my name was invoked recently on this thread (albeit with a question mark), let me try to summarize: We all agree that mutability introduces interesting issues, particularly in the face of true concurrency. Language designers are very interested in languages with semantics that avoid or

Re: [Edu-sig] Properties use case

2006-03-23 Thread Scott David Daniels
Christian Mascher wrote: Scott David Daniels wrote: copying to a minimum. With immutables, you needn't do any of the bookkeeping. It is not that you have gone terribly wrong; it is that you have opened the lid on a large class of avoidable problems. If you look at Java's strings (as I

Re: [Edu-sig] Properties use case

2006-03-22 Thread Laura Creighton
In a message of Tue, 21 Mar 2006 13:58:52 CST, Michael Tobis writes: While PyPy is a most admirable endeavor, I can't imagine that it can resolve this problem. I'll be most pleased to discover that I am wrong, so please correct me. Is scientific programming a target usage of PyPy? Yes. In

Re: [Edu-sig] Properties use case

2006-03-22 Thread Arthur
-Original Message- From: Laura Creighton [mailto:[EMAIL PROTECTED] We don't -- at least right now -- want to replace these cases where you use numeric because you really need a lot of linear algebra. Actually, the way I see it, there will be a significant benefit even when

Re: [Edu-sig] Properties use case

2006-03-21 Thread Arthur
From: Michael Tobis [mailto:[EMAIL PROTECTED] Note that when you stray from pure python you shrink your user base and complicate your support issues substantially. Haven't had the opportunity to code much anew, but am still replaying to myself where I am with these issues, and in the

Re: [Edu-sig] Properties use case

2006-03-21 Thread Michael Tobis
I use numeric a lot, and I understand what you mean. Perhaps there is some Python-like scientific language yet to be invented, but on the other hand, perhaps the interface between convenient latent typing and efficient strong typing may be fated to always be a bit uncomfortable. Meanwhile I have

Re: [Edu-sig] Properties use case

2006-03-21 Thread Laura Creighton
Arthur, have you tried using Psyco? Then you get to write your code in a naive, straightforward fashion, and then you get something that runs nearly as fast. Plus no headaches from having to write your code inside out, like numeric makes you do, all too often. Laura, sold on it, In a message

Re: [Edu-sig] Properties use case

2006-03-21 Thread Laura Creighton
In a message of Tue, 21 Mar 2006 11:17:42 CST, Michael Tobis writes: I use numeric a lot, and I understand what you mean. Perhaps there is some Python-like scientific language yet to be invented, but on the other hand, perhaps the interface between convenient latent typing and efficient strong

Re: [Edu-sig] Properties use case

2006-03-21 Thread Arthur
-Original Message- From: Michael Tobis [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 12:18 PM To: Arthur; edu-sig@python.org Subject: Re: [Edu-sig] Properties use case If you want to beat me to the punch read this thread (if you dare): http://mail.python.org

Re: [Edu-sig] Properties use case

2006-03-19 Thread Scott David Daniels
Arthur wrote: The small problem at the moment being the laptop on which I have my latest working version ain't taking well to getting powered up. ARG., Laptops are, in my experience fragile little beasties. So, this discussion has led me to think about a structure like:

Re: [Edu-sig] Properties use case

2006-03-19 Thread Arthur
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of kirby urner Sent: Sunday, March 19, 2006 10:58 AM Arthur is a really smart guy -- knows enough to get himself in real trouble. And generally have. Just a little more cautious, with age,

Re: [Edu-sig] Properties use case

2006-03-19 Thread Arthur
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott David Daniels What got me thinking about this was why would you want to share mutable state on complexes (and then on points) -- the answer is when you are applying a uniform

Re: [Edu-sig] Properties use case

2006-03-18 Thread Scott David Daniels
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

Re: [Edu-sig] Properties use case

2006-03-18 Thread Arthur
-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

Re: [Edu-sig] Properties use case

2006-03-18 Thread Laura Creighton
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

Re: [Edu-sig] Properties use case

2006-03-18 Thread Arthur
-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

Re: [Edu-sig] Properties use case

2006-03-18 Thread 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 primitives. The range of behavior for non-primitives is larger. For example, a Vertex in 3-space for a polyhedron might have mutable

Re: [Edu-sig] Properties use case

2006-03-18 Thread Chuck Allison
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,

Re: [Edu-sig] Properties use case

2006-03-18 Thread Arthur
-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

Re: [Edu-sig] Properties use case

2006-03-18 Thread Michael Tobis
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

Re: [Edu-sig] Properties use case

2006-03-18 Thread Arthur
-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.

Re: [Edu-sig] Properties use case

2006-03-18 Thread Arthur
-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

Re: [Edu-sig] Properties use case

2006-03-18 Thread Arthur
-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

Re: [Edu-sig] Properties use case

2006-03-18 Thread Arthur
-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

Re: [Edu-sig] Properties use case

2006-03-18 Thread Michael Tobis
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

Re: [Edu-sig] Properties use case

2006-03-18 Thread Arthur
-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

Re: [Edu-sig] Properties use case

2006-03-18 Thread John Zelle
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

Re: [Edu-sig] Properties use case

2006-03-18 Thread Michael Tobis
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

Re: [Edu-sig] Properties use case

2006-03-17 Thread ajsiegel
- Original Message - From: kirby urner [EMAIL PROTECTED] Date: Thursday, March 16, 2006 9:38 pm Subject: Re: [Edu-sig] Properties use case Well, philosophically, I could see where a lot of CS types might have a problem with mutable numbers, complex or otherwise. Are you a CS type

Re: [Edu-sig] Properties use case

2006-03-17 Thread Dethe Elza
Arthur: Are you a CS type? If so, speak directly. I'm a CS type (BS in CS, MS in CSEE). Kirby's right, it's generally considered better to return a new primitive type rather than mutate it in place. Many programming languages impose striction functionality which means you have no (or nearly

Re: [Edu-sig] Properties use case

2006-03-17 Thread ajsiegel
- Original Message - From: Dethe Elza [EMAIL PROTECTED] Date: Friday, March 17, 2006 6:08 pm Subject: Re: [Edu-sig] Properties use case Arthur: Are you a CS type? If so, speak directly. I'm a CS type (BS in CS, MS in CSEE). Kirby's right, it's generally considered better

Re: [Edu-sig] Properties use case

2006-03-17 Thread ajsiegel
- Original Message - From: Dethe Elza [EMAIL PROTECTED] What defines a primitive type. My understanding is that in many languages there is no complex primitive type. Each language defines its own primitive types, some have no primitive types (or hide them better), some are

Re: [Edu-sig] Properties use case

2006-03-17 Thread Dethe Elza
Obviously once I become convinced that the mutable complex numbers happens to work for my purposes, there is nothing preventing me from implementing as an extension in C. Of course. Would that put the issue to bed? No particular issue. Kirby said something, you challenged it, I'm putting

Re: [Edu-sig] Properties use case

2006-03-17 Thread ajsiegel
- Original Message - From: Dethe Elza [EMAIL PROTECTED] Yes, I know, I read that. I'm not questioning that you know this. You asked what problems from a CS viewpoint there would be. I told you. You don't like it, don't ask. Its not that I'm a bad guy. Must be that I'm just

Re: [Edu-sig] Properties use case

2006-03-17 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: Instead of having my geometric objects of the complex plane *be* complex numbes, there is certainly the solution of having a complex number as an attribute of these objects - and then I can take more your approach, and at the speed of C, since I would then be

Re: [Edu-sig] Properties use case

2006-03-17 Thread Michael Tobis
Thank you for a refreshingly terse and substantive comment! Let's have more of those! mt On 3/17/06, Scott David Daniels [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Instead of having my geometric objects of the complex plane *be* complex numbes, there is certainly the solution of

Re: [Edu-sig] Properties use case

2006-03-17 Thread Michael Tobis
On 3/17/06, Dethe Elza [EMAIL PROTECTED] wrote: Nope, perfectly willing to be shown otherwise. On the other hand, folks have dropped off the list, or threatened to, in part because of your attacks on other posters. My interest in justice has overwhelmed my interest in discretion. I have

Re: [Edu-sig] Properties use case

2006-03-17 Thread Arthur
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Scott David Daniels So, that's why CS people like immutable primitive types. I believe you. But if we trace back the thread we will see that the bottom line question that I was struggling with

Re: [Edu-sig] Properties use case

2006-03-16 Thread ajsiegel
- Original Message - From: kirby urner [EMAIL PROTECTED] Date: Thursday, March 16, 2006 5:04 pm Subject: Re: [Edu-sig] Properties use case The idea of a mutable complex number gives me the creeps. Did you say you'd seen this successfully tried somewhere? Don't lose any sleep over

Re: [Edu-sig] Properties use case

2006-03-16 Thread kirby urner
The idea of a mutable complex number gives me the creeps. Did you say you'd seen this successfully tried somewhere? Don't lose any sleep over it. Yes. PyGeo. Art Sorry you felt forced into doing something quirky for whatever reason. Or maybe it's just for the fun of it,

Re: [Edu-sig] Properties use case

2006-03-15 Thread Arthur
kirby urner wrote: I am sure I am taking at least a bit of a performance hit by going this route. Does anyone see something simple I may be missing here to get to where I am trying to get, without the hit? Art Sounds like the kind of question that should go with example code, but maybe

Re: [Edu-sig] Properties use case

2006-03-15 Thread Michael Tobis
A Numeric array is mutable; it refers to allocated memory. So any subpart of it is mutable. So I suggest you use a 1-element complex numeric array as your mutable complex type. import Numeric as N a = N.ones((20,20),N.Complex) b = N.ravel(a[1:2,1:2]) b array([ 1.+0.j]) id(b) 2741696 b += 1