Re: [Python-3000] PEP 3137: Immutable Bytes and Mutable Buffer

2007-09-26 Thread Georg Brandl
Alexandre Vassalotti schrieb: >> Indexing >> >> >> **Open Issue:** I'm undecided on whether indexing bytes and buffer >> objects should return small ints (like the bytes type in 3.0a1, and >> like lists or array.array('B')), or bytes/buffer objects of length 1 >> (like the str type). The

Re: [Python-3000] PEP 3137: Immutable Bytes and Mutable Buffer

2007-09-26 Thread Gregory P. Smith
On 9/26/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > [PEP 3137] > > > **Open Issue:** I'm undecided on whether indexing bytes and buffer > > > objects should return small ints (like the bytes type in 3.0a1, and > > > like lists or array.array('B')), or bytes/buffer objects of length 1 > > > (l

Re: [Python-3000] Immutable bytes -- looking for volunteer

2007-09-26 Thread Gregory P. Smith
On 9/26/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > > However there's quite a bit of Python 2.x code around that manipulates > > *bytes* in the guise of 8-bit strings, and it uses tests like "if s[0] > > == 'x': ..." frequently. This can of course be rewritten using a >

Re: [Python-3000] PEP 3137: Immutable Bytes and Mutable Buffer

2007-09-26 Thread Jeffrey Yasskin
On 9/26/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > ... > Indexing > > > **Open Issue:** I'm undecided on whether indexing bytes and buffer > objects should return small ints (like the bytes type in 3.0a1, and > like lists or array.array('B')), or bytes/buffer objects of length 1 > (

Re: [Python-3000] Immutable bytes -- looking for volunteer

2007-09-26 Thread Greg Ewing
Guido van Rossum wrote: > However there's quite a bit of Python 2.x code around that manipulates > *bytes* in the guise of 8-bit strings, and it uses tests like "if s[0] > == 'x': ..." frequently. This can of course be rewritten using a > slice, but not so easily when you're looping over bytes: >

Re: [Python-3000] PEP 3137: Immutable Bytes and Mutable Buffer

2007-09-26 Thread Greg Ewing
Guido van Rossum wrote: > I'm still undecided (despite Marcin's eloquent argument for ints as > bytes) but I'm open for votes for this case. Whatever is done, please don't do it *only* to make conversion from 2.x easy. There should be good independent reasons for whatever is chosen. -- Greg Ewin

Re: [Python-3000] PEP 3137: Immutable Bytes and Mutable Buffer

2007-09-26 Thread Alexandre Vassalotti
On 9/26/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > Constructors > > > There are four forms of constructors, applicable to both bytes and > buffer: > > - ``bytes()``, ``bytes()``, ``buffer()``, > ``buffer()``: simple copying constructors, with the note > that ``bytes(

Re: [Python-3000] ordered dict for p3k collections?

2007-09-26 Thread Nicholas Bastin
On 9/26/07, Jason Orendorff <[EMAIL PROTECTED]> wrote: > One situation where a sorteddict would win is finding upper and lower > bounds. This especially matters if you want to iterate over a > specific range of keys: "show me all entries between 1 Jan 2007 and 1 > Feb 2007" is O(N) in the number o

Re: [Python-3000] PEP 3137: Immutable Bytes and Mutable Buffer

2007-09-26 Thread Guido van Rossum
[PEP 3137] > > **Open Issue:** I'm undecided on whether indexing bytes and buffer > > objects should return small ints (like the bytes type in 3.0a1, and > > like lists or array.array('B')), or bytes/buffer objects of length 1 > > (like the str type). The latter (str-like) approach will ease porti

Re: [Python-3000] Immutable bytes -- looking for volunteer

2007-09-26 Thread Guido van Rossum
I find this semi-convincing. It would be very convincing in a greenfield situation I think. However there's quite a bit of Python 2.x code around that manipulates *bytes* in the guise of 8-bit strings, and it uses tests like "if s[0] == 'x': ..." frequently. This can of course be rewritten using a

Re: [Python-3000] PEP 3137: Immutable Bytes and Mutable Buffer

2007-09-26 Thread Brett Cannon
On 9/26/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Please comment. > > PEP: 3137 > Title: Immutable Bytes and Mutable Buffer > Version: $Revision: 58264 $ > Last-Modified: $Date: 2007-09-26 14:58:29 -0700 (Wed, 26 Sep 2007) $ > Author: Guido van Rossum <[EMAIL PROTECTED]> > Status: Draft > T

[Python-3000] PEP 3137: Immutable Bytes and Mutable Buffer

2007-09-26 Thread Guido van Rossum
Please comment. PEP: 3137 Title: Immutable Bytes and Mutable Buffer Version: $Revision: 58264 $ Last-Modified: $Date: 2007-09-26 14:58:29 -0700 (Wed, 26 Sep 2007) $ Author: Guido van Rossum <[EMAIL PROTECTED]> Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 26-Sep-2007 Python

Re: [Python-3000] Immutable bytes -- looking for volunteer

2007-09-26 Thread Marcin 'Qrczak' Kowalczyk
Dnia 25-09-2007, Wt o godzinie 17:22 -0700, Guido van Rossum napisał(a): > OK. Though it's questionable even whether a slice of a mutable bytes > object should return a mutable bytes object (as it is not a shared > view). But as that is what PyBytes currently do it is certainly the > easiest... A

Re: [Python-3000] ordered dict for p3k collections?

2007-09-26 Thread Charles D Hixson
[EMAIL PROTECTED] wrote: > Mark> With sorteddict you pay O(log N) for accessing, but you pay > Mark> nothing for sorting. > > Pay me now or pay me later, but maintaining a sorted sequence will always > cost something. > > Skip > Very frequently, however, I want frequent sorted access to

Re: [Python-3000] Py3k Trivia :-)

2007-09-26 Thread Nicholas Bastin
On 9/21/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 9/21/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > > Guido van Rossum wrote: > > > """ > > > George isn't tall enough to ride the greatest rollercoaster of all > > > time, The Turbo Python 3000. He uses licorice whips to measure his > > > h

Re: [Python-3000] ordered dict for p3k collections?

2007-09-26 Thread Jason Orendorff
One situation where a sorteddict would win is finding upper and lower bounds. This especially matters if you want to iterate over a specific range of keys: "show me all entries between 1 Jan 2007 and 1 Feb 2007" is O(N) in the number of entries in that range, not the entire data set. I think peop

Re: [Python-3000] ordered dict for p3k collections?

2007-09-26 Thread Martin v. Löwis
>> When I program in C++/Qt I use QMap (a sorteddict) very often; the STL >> equivalent is called map. Both the Qt and STL libraries have dict >> equivalents (QHash and unordered_map), but my impression is that the >> sorted data structures are used far more frequently than the unsorted >> versions

Re: [Python-3000] ordered dict for p3k collections?

2007-09-26 Thread skip
Mark> With sorteddict you pay O(log N) for accessing, but you pay Mark> nothing for sorting. Pay me now or pay me later, but maintaining a sorted sequence will always cost something. Skip ___ Python-3000 mailing list Python-3000@python.org http

Re: [Python-3000] Immutable bytes -- looking for volunteer

2007-09-26 Thread Guido van Rossum
Sounds like we need a PEP to sort out the details. I'll try to come up with something. -- --Guido van Rossum (home page: http://www.python.org/~guido/) ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-30

Re: [Python-3000] ordered dict for p3k collections?

2007-09-26 Thread Jim Jewett
On 9/26/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 9/26/07, Mark Summerfield <[EMAIL PROTECTED]> wrote: > > Assuming you have a good sorteddict implementation ... > > you can gain significant performance benefits. > ... sorted dict implementation, the best performance you can get for >

Re: [Python-3000] ordered dict for p3k collections?

2007-09-26 Thread Mark Summerfield
On 2007-09-26, Guido van Rossum wrote: > On 9/26/07, Mark Summerfield <[EMAIL PROTECTED]> wrote: > > On 2007-09-26, [EMAIL PROTECTED] wrote: > > > Mark> I have put a new version (incorporating another > > > implementation Mark> idea from Paul Hankin) on PyPI: > > > > > > Mark> http://pypi.p

Re: [Python-3000] ordered dict for p3k collections?

2007-09-26 Thread Guido van Rossum
On 9/26/07, Mark Summerfield <[EMAIL PROTECTED]> wrote: > On 2007-09-26, [EMAIL PROTECTED] wrote: > > Mark> I have put a new version (incorporating another implementation > > Mark> idea from Paul Hankin) on PyPI: > > > > Mark> http://pypi.python.org/pypi/sorteddict > > > > From that: >

Re: [Python-3000] ordered dict for p3k collections?

2007-09-26 Thread Mark Summerfield
On 2007-09-26, [EMAIL PROTECTED] wrote: > Mark> I have put a new version (incorporating another implementation > Mark> idea from Paul Hankin) on PyPI: > > Mark> http://pypi.python.org/pypi/sorteddict > > From that: > > The main benefit of sorteddicts is that you never have to explic

Re: [Python-3000] ordered dict for p3k collections?

2007-09-26 Thread skip
Mark> I have put a new version (incorporating another implementation Mark> idea from Paul Hankin) on PyPI: Mark> http://pypi.python.org/pypi/sorteddict >From that: The main benefit of sorteddicts is that you never have to explicitly sort. Surely there must be something more

Re: [Python-3000] ordered dict for p3k collections?

2007-09-26 Thread Mark Summerfield
On 2007-09-26, Mike Klaas wrote: > On 25-Sep-07, at 2:01 PM, Mark Summerfield wrote: > > On 2007-09-25, Guido wrote: > >> For that to happen, someone has to write a production-quality > >> implementation, release it as a separate 3rd party module for a > >> while, > >> show that it is sufficiently