Re: [Python-Dev] Pre-PEP: The "bytes" object

2006-02-27 Thread Greg Ewing
Jason Orendorff wrote: > I like these promises: > - bytes(arg) works like array.array('b', arg) > - bytes(arg1, arg2) works like bytes(arg1.encode(arg2)) +1. That's exactly how I think it should work, too. > I dislike these promises: > - bytes(s, [ignored]), where s is a str, works like ar

Re: [Python-Dev] Pre-PEP: The "bytes" object

2006-02-27 Thread Jason Orendorff
Neil Schemenauer wrote: > Ron Adam <[EMAIL PROTECTED]> wrote: >> Why was it decided that the unicode encoding argument should be ignored >> if the first argument is a string? Wouldn't an exception be better >> rather than give the impression it does something when it doesn't? > >From the PEP: > >

Re: [Python-Dev] Pre-PEP: The "bytes" object

2006-02-24 Thread Ron Adam
Neil Schemenauer wrote: > Ron Adam <[EMAIL PROTECTED]> wrote: >> Why was it decided that the unicode encoding argument should be ignored >> if the first argument is a string? Wouldn't an exception be better >> rather than give the impression it does something when it doesn't? > >>From the PEP:

Re: [Python-Dev] Pre-PEP: The "bytes" object

2006-02-24 Thread Neil Schemenauer
Ron Adam <[EMAIL PROTECTED]> wrote: > Why was it decided that the unicode encoding argument should be ignored > if the first argument is a string? Wouldn't an exception be better > rather than give the impression it does something when it doesn't? >From the PEP: There is no sane meaning th

Re: [Python-Dev] Pre-PEP: The "bytes" object

2006-02-24 Thread Ron Adam
Neil Schemenauer wrote: > Michael Hoffman <[EMAIL PROTECTED]> wrote: >> Am I the only one who finds the use of "self" on a classmethod to be >> incredibly confusing? Can we please follow PEP 8 and use "cls" >> instead? > > Sorry, using "self" was an oversight. It should be "cls", IMO. > > Neil

Re: [Python-Dev] Pre-PEP: The "bytes" object

2006-02-24 Thread Neil Schemenauer
Michael Hoffman <[EMAIL PROTECTED]> wrote: > Am I the only one who finds the use of "self" on a classmethod to be > incredibly confusing? Can we please follow PEP 8 and use "cls" > instead? Sorry, using "self" was an oversight. It should be "cls", IMO. Neil ___

Re: [Python-Dev] Pre-PEP: The "bytes" object

2006-02-24 Thread Michael Hoffman
[Neil Schemenauer] >> @classmethod >> def fromhex(self, data): >> data = re.sub(r'\s+', '', data) >> return bytes(binascii.unhexlify(data)) [Jason Orendorff] > If it's to be a classmethod, I guess that should be "return self( > binascii.unhexlify(data))". Am I the only one

Re: [Python-Dev] Pre-PEP: The "bytes" object

2006-02-23 Thread Jason Orendorff
On 2/22/06, Neil Schemenauer <[EMAIL PROTECTED]> wrote:     @classmethoddef fromhex(self, data):data = "" '', data)return bytes(binascii.unhexlify(data))If it's to be a classmethod, I guess that should be "return self( binascii.unhexlify(data))".-j __

Re: [Python-Dev] Pre-PEP: The "bytes" object

2006-02-22 Thread Neil Schemenauer
On Thu, Feb 16, 2006 at 12:47:22PM -0800, Guido van Rossum wrote: > BTW, for folks who want to experiment, it's quite simple to create a > working bytes implementation by inheriting from array.array. Here's a > quick draft (which only takes str instance arguments): Here's a more complete prototype

Re: [Python-Dev] Pre-PEP: The "bytes" object

2006-02-17 Thread M.-A. Lemburg
Guido van Rossum wrote: > On 2/15/06, Neil Schemenauer <[EMAIL PROTECTED]> wrote: >> This could be a replacement for PEP 332. At least I hope it can >> serve to summarize the previous discussion and help focus on the >> currently undecided issues. >> >> I'm too tired to dig up the rules for assign

Re: [Python-Dev] Pre-PEP: The "bytes" object

2006-02-17 Thread Guido van Rossum
On 2/15/06, Neil Schemenauer <[EMAIL PROTECTED]> wrote: > This could be a replacement for PEP 332. At least I hope it can > serve to summarize the previous discussion and help focus on the > currently undecided issues. > > I'm too tired to dig up the rules for assigning it a PEP number. > Also, th

Re: [Python-Dev] Pre-PEP: The "bytes" object

2006-02-17 Thread Bengt Richter
On Thu, 16 Feb 2006 12:47:22 -0800, Guido van Rossum <[EMAIL PROTECTED]> wrote: >On 2/15/06, Neil Schemenauer <[EMAIL PROTECTED]> wrote: >> This could be a replacement for PEP 332. At least I hope it can >> serve to summarize the previous discussion and help focus on the >> currently undecided is

[Python-Dev] Pre-PEP: The "bytes" object

2006-02-15 Thread Neil Schemenauer
This could be a replacement for PEP 332. At least I hope it can serve to summarize the previous discussion and help focus on the currently undecided issues. I'm too tired to dig up the rules for assigning it a PEP number. Also, there are probably silly typos, etc. Sorry. Neil PEP: XXX Title: