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

2007-09-15 Thread Arvind Singh
> > I hope that Python gets a sorteddict and a > sortedset. It doesn't make sense for Python to have sorteddict or sortedset. You see, dict can have keys which cannot be ordered (keys can be heterogeneous, in which case Py3K may raise TypeError; ordering doesn't make sense for the objects used a

Re: [Python-3000] Unicode and OS strings

2007-09-15 Thread Hagen Fürstenau
>> sys.argv could be of type bytes and sys.arguments (or whatever) could be >> a function taking an encoding parameter (which defaults to UTF-8) and >> returning strings. >> > It would be pretty disruptive to ask everyone to change > their habit of thinking of sys.argv as a list of strings. The

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

2007-09-15 Thread Neville Grech Neville Grech
>From a python's user point of view. a sorted dict/set/list was sometimes a requirement for me. Basically. a dictionary that had a BTree implementation instead of a hash table. Also. having an explicit type error would then be a clear indication that you have something wrong in your implementattion

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

2007-09-15 Thread Georg Brandl
Arvind Singh schrieb: > I hope that Python gets a sorteddict and a > sortedset. > > > It doesn't make sense for Python to have sorteddict or sortedset. You > see, dict can have keys which cannot be ordered (keys can be > heterogeneous, in which case Py3K may raise TypeError; ordering d

Re: [Python-3000] patch: bytes object PyBUF_LOCKDATA read-only and immutable support

2007-09-15 Thread Gregory P. Smith
On 9/13/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > Gregory P. Smith wrote: > > When I read the plain term EXCLUSIVE I read that to mean nobody else can > > read -or- write, ie: not shared in any sense. > > You're right, it's not the best term. > > > Lets extend these base > > concepts to SHARED_RE

Re: [Python-3000] patch: bytes object PyBUF_LOCKDATA read-only and immutable support

2007-09-15 Thread Gregory P. Smith
On 9/13/07, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > I think if it doesn't go through the buffer interface it is up to the > object to decide (i.e. what does the object do with itself when buffers > are exported --- that will depend on the object). All it must do is > support the buffer in

Re: [Python-3000] Unicode and OS strings

2007-09-15 Thread Gregory P. Smith
On 9/14/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > Hagen Fürstenau wrote: > > sys.argv could be of type bytes and sys.arguments (or whatever) could be > > a function taking an encoding parameter (which defaults to UTF-8) and > > returning strings. > > > > Of course that's backwards incompatible an

Re: [Python-3000] Unicode and OS strings

2007-09-15 Thread Paul Moore
On 15/09/2007, Gregory P. Smith <[EMAIL PROTECTED]> wrote: > similarly for the environment. os.environ dict > should be bytes object keys and values You can't have bytes as keys - the type isn't hashable... Paul ___ Python-3000 mailing list Python-3000

Re: [Python-3000] Unicode and OS strings

2007-09-15 Thread Gregory P. Smith
On 9/15/07, Paul Moore <[EMAIL PROTECTED]> wrote: > On 15/09/2007, Gregory P. Smith <[EMAIL PROTECTED]> wrote: > > similarly for the environment. os.environ dict > > should be bytes object keys and values > > You can't have bytes as keys - the type isn't hashable... ugh, yeah. as much as i hate

Re: [Python-3000] Unicode and OS strings

2007-09-15 Thread Aahz
On Fri, Sep 14, 2007, "Martin v. L??wis" wrote: >Hagen: >> >> And what if we skillfully conserve unknown bytes in a private use or >> surrogate area and the application author actually knows the encoding >> and wants correctly decoded strings? > > They can easily roundtrip that then to the encodi

Re: [Python-3000] Unicode and OS strings

2007-09-15 Thread Aahz
On Sat, Sep 15, 2007, Paul Moore wrote: > On 15/09/2007, Gregory P. Smith <[EMAIL PROTECTED]> wrote: >> >> similarly for the environment. os.environ dict >> should be bytes object keys and values > > You can't have bytes as keys - the type isn't hashable... That's why people keep arguing for an

[Python-3000] Move argv[0]? (Re: Unicode and OS strings)

2007-09-15 Thread Greg Ewing
> Also "argv" sounds more low-level than something like "arguments". While we're on the subject of argv, I've been wondering whether py3k might want to revisit the idea of having argv[0] be the program name. In my experience, one almost *never* wants to treat argv[0] the same way as the rest of t

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

2007-09-15 Thread Nicholas Bastin
On 9/15/07, Arvind Singh <[EMAIL PROTECTED]> wrote: > > > I hope that Python gets a sorteddict and a > > sortedset. > > It doesn't make sense for Python to have sorteddict or sortedset. You see, > dict can have keys which cannot be ordered (keys can be heterogeneous, in > which case Py3K may raise

Re: [Python-3000] Unicode and OS strings

2007-09-15 Thread Nicholas Bastin
On 9/15/07, Paul Moore <[EMAIL PROTECTED]> wrote: > On 15/09/2007, Gregory P. Smith <[EMAIL PROTECTED]> wrote: > > similarly for the environment. os.environ dict > > should be bytes object keys and values > > You can't have bytes as keys - the type isn't hashable... Then lets stop beating around

Re: [Python-3000] Move argv[0]? (Re: Unicode and OS strings)

2007-09-15 Thread Guido van Rossum
This sounds awfully close to bikeshedding. Change too many details like this and you cause death by a 1000 pinpricks for existing apps. sys.argv[0] *does* get used (though arguably rarely in the same way as sys.argv[1:]). --Guido On 9/15/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > > Also "argv"

Re: [Python-3000] Unicode and OS strings

2007-09-15 Thread Bill Janssen
> > You can't have bytes as keys - the type isn't hashable... > > That's why people keep arguing for an immutable bytes types. I keep > seeing long discussions that end up with a tortured mechanism for making > the keys unicode. Why don't we just bite the bullet and make things > easier and have

Re: [Python-3000] Unicode and OS strings

2007-09-15 Thread Fred Drake
On Sep 15, 2007, at 10:00 PM, Nicholas Bastin wrote: > Then lets stop beating around the bush and implement an immutable > bytes type. Why put ourselves through contortions trying to jam a > square peg into a round hole and not just decide to make a round peg? +42 -Fred -- Fred Drake