Re: [Python-Dev] inheriting basic types more efficiently

2006-04-27 Thread Josiah Carlson
Dennis Heuer [EMAIL PROTECTED] wrote: OK, let's get back to the bitarray type. To first be clear about the *type* of bitarray: The type I talk about is really a *bit*-array and not a *bytewise*-array, as most developers seem to think of it. The array doesn't provide the boolean manipulation

Re: [Python-Dev] inheriting basic types more efficiently

2006-04-27 Thread Dennis Heuer
The real misunderstanding lies somewhere else. I thought that the bitarray's instance would have more control over the long type's instance, like with the mutable types. I thought that the long type's superclass would provide methods similar to __setitem__ that would allow the bitarray instance to

Re: [Python-Dev] inheriting basic types more efficiently

2006-04-27 Thread Martin v. Löwis
Dennis Heuer wrote: The real misunderstanding lies somewhere else. I thought that the bitarray's instance would have more control over the long type's instance, like with the mutable types. I thought that the long type's superclass would provide methods similar to __setitem__ that would allow

Re: [Python-Dev] inheriting basic types more efficiently

2006-04-26 Thread Dennis Heuer
Have never seen such an answer before. Please excuse if I read it wrong. The method would just return the new values, for shure. That is what it shall do. The interpreter calls that method for receiving the new (to be used) values to pass them on to the real target (the called attribute). The

Re: [Python-Dev] inheriting basic types more efficiently

2006-04-26 Thread Dennis Heuer
To bring the real problem more upfront. Up to now, inheriting classes is all about processing (the output channel) but not about retrieving (the input channel). However, though a new type can advance from an existing type if it just needs to provide some few more methods, it can not advance from

Re: [Python-Dev] inheriting basic types more efficiently

2006-04-26 Thread Guido van Rossum
I doubt you'll get many answers. I have no idea what you're talking about. How about an example or two? On 4/26/06, Dennis Heuer [EMAIL PROTECTED] wrote: To bring the real problem more upfront. Up to now, inheriting classes is all about processing (the output channel) but not about retrieving

Re: [Python-Dev] inheriting basic types more efficiently

2006-04-26 Thread Dennis Heuer
OK, let's get back to the bitarray type. To first be clear about the *type* of bitarray: The type I talk about is really a *bit*-array and not a *bytewise*-array, as most developers seem to think of it. The array doesn't provide the boolean manipulation of single bytes in the array, it provides

Re: [Python-Dev] inheriting basic types more efficiently

2006-04-26 Thread Guido van Rossum
I still don't understand what you are asking for. However there's one problem with your code: On 4/26/06, Dennis Heuer [EMAIL PROTECTED] wrote: class bitarray(long): ... def __setitem__(self, key, value): [...] long.__add__(2**key * value) # Should actually overwrite the

Re: [Python-Dev] inheriting basic types more efficiently

2006-04-26 Thread Martin v. Löwis
Dennis Heuer wrote: The reason why I'd like to use the long type as the base of my bitarray type is that the long type is already implemented as an array and working efficiently with large amounts of bytes. This is wrong; you are mixing up the is-a and has-a relationships. While it might be