Re: [Python-Dev] bytes thoughts

2006-03-17 Thread Paul Moore
On 3/17/06, Josiah Carlson <[EMAIL PROTECTED]> wrote: > Considering your quote, I have thusfar not seen any opinion dissenting > from what I stated as 'obvious' behavior. FWIW, I have no objections to the behaviour you state as "obvious", but I didn't find it immediately obvious (although admitted

Re: [Python-Dev] bytes thoughts

2006-03-17 Thread Josiah Carlson
"Christos Georgiou" <[EMAIL PROTECTED]> wrote: > [Christos] > > These details should be considered in the PEP. > > [Josiah] > > They aren't considered because they are *obvious* to most (if not all) > > sane people who use Python. > > I beg to disagree. I don't know whether you are Dutch or not

Re: [Python-Dev] bytes thoughts

2006-03-17 Thread Christos Georgiou
"Josiah Carlson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] "Christos Georgiou" <[EMAIL PROTECTED]> wrote: [Christos] > Well, what's the result of > > bytes([1,0,0])^ bytes([1,0]) > > ? Is it bytes([0,0,0]) (à la little-endian) or is it bytes([1,1,0]) > (straight conversion to

Re: [Python-Dev] bytes thoughts

2006-03-16 Thread Guido van Rossum
On 3/16/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > BTW, is anyone else bothered that the term "bytes object" > is a bit cumbersome? Also confusing as to whether it's > singular or plural. Could we perhaps call it a bytevector > or bytearray or something? Doesn't really bother me. You could call i

Re: [Python-Dev] bytes thoughts

2006-03-16 Thread Greg Ewing
Baptiste Carvello wrote: > They are not *that* obvious. Logical operations on ints have allowed users to > forget about size (and shoot themselves in the foot from time to time). Or is > 1^(~1) == -1 obvious ? Well, maybe that's not sane either :-) It's about as sane as you can get in a world wh

Re: [Python-Dev] bytes thoughts

2006-03-16 Thread Josiah Carlson
Baptiste Carvello <[EMAIL PROTECTED]> wrote: > Josiah Carlson a écrit : > > > They aren't considered because they are *obvious* to most (if not all) > > sane people who use Python. > > They are not *that* obvious. Logical operations on ints have allowed users to > forget about size (and shoot

Re: [Python-Dev] bytes thoughts

2006-03-16 Thread Greg Ewing
Christos Georgiou wrote: > Well, what's the result of > > bytes([1,0,0])^ bytes([1,0]) > > ? Is it bytes([0,0,0]) (à la little-endian) or is it bytes([1,1,0]) > (straight conversion to base-256)? Or perhaps throw a ValueError if the > sizes differ? In the interests of refusing the temptation

Re: [Python-Dev] bytes thoughts

2006-03-16 Thread Baptiste Carvello
Josiah Carlson a écrit : > They aren't considered because they are *obvious* to most (if not all) > sane people who use Python. They are not *that* obvious. Logical operations on ints have allowed users to forget about size (and shoot themselves in the foot from time to time). Or is 1^(~1) ==

Re: [Python-Dev] bytes thoughts

2006-03-16 Thread Josiah Carlson
"Christos Georgiou" <[EMAIL PROTECTED]> wrote: > Well, what's the result of > > bytes([1,0,0])^ bytes([1,0]) > > ? Is it bytes([0,0,0]) (à la little-endian) or is it bytes([1,1,0]) > (straight conversion to base-256)? Or perhaps throw a ValueError if the > sizes differ? It's a ValueError. I

Re: [Python-Dev] bytes thoughts

2006-03-16 Thread Christos Georgiou
"Greg Ewing" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Baptiste Carvello wrote: > [Baptiste] >> while manipulating binary data will happen mostly with bytes objects, >> some >> operations are better done with ints, like the bit manipulations with the >> &|~^ >> operators. [Gre

Re: [Python-Dev] bytes thoughts

2006-03-02 Thread Baptiste Carvello
Greg Ewing a écrit : > Why not just support bitwise operations directly > on the bytes object? > Sure, what counts is that all the nice features that Python has for editing binary data are usable with the bytes object. These include bitwise operations, hex() and oct() representation functions an

Re: [Python-Dev] bytes thoughts

2006-03-02 Thread Nick Coghlan
Greg Ewing wrote: > Baptiste Carvello wrote: > >> while manipulating binary data will happen mostly with bytes objects, some >> operations are better done with ints, like the bit manipulations with the >> &|~^ >> operators. > > Why not just support bitwise operations directly > on the bytes ob

Re: [Python-Dev] bytes thoughts

2006-03-01 Thread Greg Ewing
Baptiste Carvello wrote: > while manipulating binary data will happen mostly with bytes objects, some > operations are better done with ints, like the bit manipulations with the > &|~^ > operators. Why not just support bitwise operations directly on the bytes object? -- Greg Ewing, Computer

Re: [Python-Dev] bytes thoughts

2006-03-01 Thread Baptiste Carvello
some more thoughts about the bytes object: 1) it would be nice to have an trivial way to change a bytes object to an int / long, and vice versa. Rationale: while manipulating binary data will happen mostly with bytes objects, some operations are better done with ints, like the bit manipulation

[Python-Dev] bytes thoughts

2006-03-01 Thread Jason Orendorff
1. Maybe there should be a more obvious way to spell "bytes([0])*N". I went through "bytes([0]*N)" and "bytes('\0'*N)" before I realized there was a memory-efficient way to do it. 1a. Likewise, slice-assignment nicely handles memmove(), but there's no memset(). 2. Having a plural noun as a typ