Re: [Python-3000] Building next alphas

2008-04-02 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Apr 2, 2008, at 6:00 PM, Barry Warsaw wrote: > > This is a reminder that I am going to start building the next alpha > releases for Python 2.6 and 3.0 now. Please, no checkins unless you > get approval from me, and until you hear that the freez

Re: [Python-3000] Types and classes

2008-04-02 Thread Terry Reedy
"Guido van Rossum" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | All I really mean to fix is to standardize the terminology, I have recently been thinking about how to present/explain the basics of Python3 to someone with no experience of Python1/2 or any need to know about the

Re: [Python-3000] Are bytes object really immutable?

2008-04-02 Thread Amaury Forgeot d'Arc
On Thu, Apr 3, 2008 at 12:10 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On Wed, Apr 2, 2008 at 2:47 PM, Amaury Forgeot d'Arc <[EMAIL PROTECTED]> > wrote: > > Stop me if I'm wrong, but I thought that bytes objects are immutable > > (they are based on the PyStringType, after all) > > Righ

Re: [Python-3000] Types and classes

2008-04-02 Thread Guido van Rossum
On Wed, Apr 2, 2008 at 4:45 PM, Paul Prescod <[EMAIL PROTECTED]> wrote: > Also, could the types module be renamed "builtin_classes" or > "core_classes" or something like that? It was always a weird name > because it wasn't if it contained all of the types in a Python > distribution. Just a set o

Re: [Python-3000] Types and classes

2008-04-02 Thread Guido van Rossum
No, we're not renaming fundamentals like that. 3.0a4 goes out tomorrow and we want stability. On Wed, Apr 2, 2008 at 4:39 PM, Robert Brewer <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > On Wed, Apr 2, 2008 at 11:57 PM, > > Paul Prescod <[EMAIL PROTECTED]> wrote: > > > But does anyone

Re: [Python-3000] Types and classes

2008-04-02 Thread Paul Prescod
Also, could the types module be renamed "builtin_classes" or "core_classes" or something like that? It was always a weird name because it wasn't if it contained all of the types in a Python distribution. Just a set of core-to-the-implementation ones. Just out of curiousity: why is the type(x) func

Re: [Python-3000] Types and classes

2008-04-02 Thread Robert Brewer
Guido van Rossum wrote: > On Wed, Apr 2, 2008 at 11:57 PM, > Paul Prescod <[EMAIL PROTECTED]> wrote: > > But does anyone else find it odd that the types of some things > > are classes and the classes of some things are types? > > > > >>> type(socket.socket()) > > > > >>> type("abc") > > > > >>>

Re: [Python-3000] PEP 3102 question

2008-04-02 Thread Guido van Rossum
On Wed, Apr 2, 2008 at 4:19 PM, Thomas Wouters <[EMAIL PROTECTED]> wrote: > On Wed, Apr 2, 2008 at 2:14 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > Thomas Wouters's changes for variable tuple packing might fix this, if > > we can agree to add that feature. > In all fairness, liberating the

Re: [Python-3000] PEP 3102 question

2008-04-02 Thread Thomas Wouters
On Wed, Apr 2, 2008 at 2:14 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Thomas Wouters's changes for variable tuple packing might fix this, if > we can agree to add that feature. > In all fairness, liberating the argument-unpacking doesn't *require* the variable sequence unpacking patch, al

Re: [Python-3000] PEP 3102 question

2008-04-02 Thread Thomas Wouters
On Wed, Apr 2, 2008 at 10:30 PM, Alexander Belopolsky < [EMAIL PROTECTED]> wrote: > On Wed, Apr 2, 2008 at 3:47 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > > > Thomas Wouters's changes for variable tuple packing might fix > this, if > > > > we can agree to add that feature. > .. >

Re: [Python-3000] Types and classes

2008-04-02 Thread Georg Brandl
Guido van Rossum schrieb: > On Wed, Apr 2, 2008 at 3:03 PM, Amaury Forgeot d'Arc <[EMAIL PROTECTED]> > wrote: >> On Wed, Apr 2, 2008 at 11:57 PM, Paul Prescod <[EMAIL PROTECTED]> wrote: >> > But does anyone else find it odd that the types of some things are >> > classes and the classes of som

Re: [Python-3000] Types and classes

2008-04-02 Thread Guido van Rossum
No. types *have* a __dict__, but it's readonly. Some type *instances* don't have a __dict__, but that's up to the individual type. All I really mean to fix is to standardize the terminology, especially in repr(). On Wed, Apr 2, 2008 at 4:04 PM, Benjamin Peterson <[EMAIL PROTECTED]> wrote: > > >

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Mike Klaas
On 2-Apr-08, at 3:48 PM, Martin v. Löwis wrote: >> On Wed, Apr 2, 2008 at 5:08 PM, Mike Klaas <[EMAIL PROTECTED]> >> wrote: >>> ...and the majority of these cases would work fine with views (input >>> to sorted(), etc). >> >> Suppose "the majority" here means 36 of the 46 cases. > > What makes yo

Re: [Python-3000] Types and classes

2008-04-02 Thread Benjamin Peterson
On Wed, Apr 2, 2008 at 6:01 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I don't recall proposing a name change. And I still don't see what > metaclasses have to do with it; I just mentioned them because 'type' > is both usable as a built-in function to access an object's class, and > as a me

Re: [Python-3000] Types and classes

2008-04-02 Thread Guido van Rossum
I don't recall proposing a name change. And I still don't see what metaclasses have to do with it; I just mentioned them because 'type' is both usable as a built-in function to access an object's class, and as a metaclass (in fact it is the root metaclass). On Wed, Apr 2, 2008 at 3:58 PM, Benjamin

Re: [Python-3000] Types and classes

2008-04-02 Thread Guido van Rossum
I have no idea what you are saying here (and I did s/since/sense/ :-). On Wed, Apr 2, 2008 at 3:34 PM, Benjamin Peterson <[EMAIL PROTECTED]> wrote: > > > > > On Wed, Apr 2, 2008 at 5:20 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > > On Wed, Apr 2, 2008 at 3:03 PM, Amaury Forgeot d'Arc <[E

Re: [Python-3000] Types and classes

2008-04-02 Thread Benjamin Peterson
On Wed, Apr 2, 2008 at 5:51 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > I have no idea what you are saying here (and I did s/since/sense/ :-). Another lesson to me, that I should proofread my Python impulses: :P Especially because of that I think we should do that. list, dict, and set aren'

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Mike Klaas
On 2-Apr-08, at 3:33 PM, Jason Orendorff wrote: > On Wed, Apr 2, 2008 at 5:08 PM, Mike Klaas <[EMAIL PROTECTED]> > wrote: >> ...and the majority of these cases would work fine with views (input >> to sorted(), etc). > > Suppose "the majority" here means 36 of the 46 cases. Then what > you're sa

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Martin v. Löwis
> On Wed, Apr 2, 2008 at 5:08 PM, Mike Klaas <[EMAIL PROTECTED]> wrote: >> ...and the majority of these cases would work fine with views (input >> to sorted(), etc). > > Suppose "the majority" here means 36 of the 46 cases. What makes you suppose so. In the standard library of Python 2.5, I cou

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Benjamin Peterson
On Wed, Apr 2, 2008 at 5:33 PM, Jason Orendorff <[EMAIL PROTECTED]> wrote: > On Wed, Apr 2, 2008 at 5:08 PM, Mike Klaas <[EMAIL PROTECTED]> wrote: > > ...and the majority of these cases would work fine with views (input > > to sorted(), etc). > > Suppose "the majority" here means 36 of the 46 ca

Re: [Python-3000] Types and classes

2008-04-02 Thread Benjamin Peterson
On Wed, Apr 2, 2008 at 5:20 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On Wed, Apr 2, 2008 at 3:03 PM, Amaury Forgeot d'Arc <[EMAIL PROTECTED]> > wrote: > > On Wed, Apr 2, 2008 at 11:57 PM, Paul Prescod <[EMAIL PROTECTED]> wrote: > > > But does anyone else find it odd that the types of s

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Jason Orendorff
On Wed, Apr 2, 2008 at 5:08 PM, Mike Klaas <[EMAIL PROTECTED]> wrote: > ...and the majority of these cases would work fine with views (input > to sorted(), etc). Suppose "the majority" here means 36 of the 46 cases. Then what you're saying is, if I write .items() without thinking, there's about

Re: [Python-3000] Types and classes

2008-04-02 Thread Guido van Rossum
On Wed, Apr 2, 2008 at 3:03 PM, Amaury Forgeot d'Arc <[EMAIL PROTECTED]> wrote: > On Wed, Apr 2, 2008 at 11:57 PM, Paul Prescod <[EMAIL PROTECTED]> wrote: > > But does anyone else find it odd that the types of some things are > > classes and the classes of some things are types? > > > > >>>

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Mike Klaas
On 2-Apr-08, at 2:59 PM, Martin v. Löwis wrote: > Jason Orendorff wrote: >> On Tue, Apr 1, 2008 at 9:37 PM, "Martin v. Löwis" >> <[EMAIL PROTECTED]> wrote: >>> I think it's fairly obvious why the 2.x .keys() has to change. It's >>> just too wasteful to actually build the list of all keys of a >

Re: [Python-3000] Are bytes object really immutable?

2008-04-02 Thread Travis Oliphant
Amaury Forgeot d'Arc wrote: > Stop me if I'm wrong, but I thought that bytes objects are immutable > (they are based on the PyStringType, after all) > > But I was surprised by this code in test_socket.py:: > > buf = b" "*1024 > nbytes = self.cli_conn.recv_into(buf) > I'm not sur

Re: [Python-3000] Are bytes object really immutable?

2008-04-02 Thread Guido van Rossum
On Wed, Apr 2, 2008 at 2:47 PM, Amaury Forgeot d'Arc <[EMAIL PROTECTED]> wrote: > Stop me if I'm wrong, but I thought that bytes objects are immutable > (they are based on the PyStringType, after all) Right. In 3.0a1 they were mutable, that's probably where these examples come from. > But I was

Re: [Python-3000] Types and classes

2008-04-02 Thread Amaury Forgeot d'Arc
Hello, On Wed, Apr 2, 2008 at 11:57 PM, Paul Prescod <[EMAIL PROTECTED]> wrote: > Apologies if this has been discussed before. > > But does anyone else find it odd that the types of some things are > classes and the classes of some things are types? > > >>> type(socket.socket()) > > >>> type

[Python-3000] Building next alphas

2008-04-02 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 This is a reminder that I am going to start building the next alpha releases for Python 2.6 and 3.0 now. Please, no checkins unless you get approval from me, and until you hear that the freeze is lifted. I am now on freenode #python-dev, IM, and

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Martin v. Löwis
Jason Orendorff wrote: > On Tue, Apr 1, 2008 at 9:37 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: >> I think it's fairly obvious why the 2.x .keys() has to change. It's >> just too wasteful to actually build the list of all keys of a dictionary >> (or even of all values, as you have to creat

[Python-3000] Types and classes

2008-04-02 Thread Paul Prescod
Apologies if this has been discussed before. But does anyone else find it odd that the types of some things are classes and the classes of some things are types? >>> type(socket.socket()) >>> type("abc") >>> socket.socket().__class__ >>> "abc".__class__ In a recent talk I could only explain

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Jason Orendorff
On Tue, Apr 1, 2008 at 9:37 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > I think it's fairly obvious why the 2.x .keys() has to change. It's > just too wasteful to actually build the list of all keys of a dictionary > (or even of all values, as you have to create all the tuples as well), >

[Python-3000] Are bytes object really immutable?

2008-04-02 Thread Amaury Forgeot d'Arc
Stop me if I'm wrong, but I thought that bytes objects are immutable (they are based on the PyStringType, after all) But I was surprised by this code in test_socket.py:: buf = b" "*1024 nbytes = self.cli_conn.recv_into(buf) And this in getargs.c:: case 'w': { /* memory b

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread David Pokorny
On Wed, Apr 2, 2008 at 11:36 AM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > The problem is that if you make the slow and fool-proof implementation > the common name, you'll have to invent another name for the fast (but > sometimes less convenient) method. This is what we ended up doing in >

Re: [Python-3000] PEP 3102 question

2008-04-02 Thread Alexander Belopolsky
On Wed, Apr 2, 2008 at 3:47 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > Thomas Wouters's changes for variable tuple packing might fix this, if > > > we can agree to add that feature. .. > > Thomas isn't finished yet. The reason I am asking is that I've been looking into ways of f

Re: [Python-3000] PEP 3102 question

2008-04-02 Thread Guido van Rossum
On Wed, Apr 2, 2008 at 12:39 PM, Alexander Belopolsky <[EMAIL PROTECTED]> wrote: > On Tue, Apr 1, 2008 at 8:14 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > .. > > Thomas Wouters's changes for variable tuple packing might fix this, if > > we can agree to add that feature. > > > > Do you

Re: [Python-3000] PEP 3102 question

2008-04-02 Thread Alexander Belopolsky
On Tue, Apr 1, 2008 at 8:14 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: .. > Thomas Wouters's changes for variable tuple packing might fix this, if > we can agree to add that feature. > Do you mean http://bugs.python.org/issue2292 ? From description it does not seem to address function call

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Martin v. Löwis
> Is there a particular rationale describing the use of function calls > vs. object properties in core Python? > > When I see a function call required for something that could be > conveniently expressed as a property, it generally tells me "I'm > computing something. It might be expensive,

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Guido van Rossum
We went over this a few years ago when we first reviewed this design from every POV. We decided that .keys() has been ingrained in the collective mind of Python users for such a long time that it would be a mistake to change it. On Wed, Apr 2, 2008 at 11:57 AM, Ivan Krstić <[EMAIL PROTECTED]> wrot

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Ivan Krstić
On Apr 2, 2008, at 11:36 AM, Guido van Rossum wrote: > I predict that list(x.keys()) will remain a rarity (except in > code converted by 2to3). However sorted(x.keys()) will become a > well-known idiom, and it's a much better one than the old idiom > keys = x.keys() > keys.sort() > which doesn't

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Guido van Rossum
On Tue, Apr 1, 2008 at 11:00 PM, David Pokorny <[EMAIL PROTECTED]> wrote: > On Tue, Apr 1, 2008 at 7:37 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > I think it's fairly obvious why the 2.x .keys() has to change. It's > > just too wasteful to actually build the list of all keys of a dict

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Martin v. Löwis
> The biggest concern I have is over whether the following works: > > for i, k in enumerate(d.keys()): > if i % 2: del d[k] > > If this code works as is in py3k, I have no concerns over whether > keys(), etc., return snapshots or live views. Define "works". This code does not "work"

Re: [Python-3000] Method to populate tp_* slots via getattr()?

2008-04-02 Thread Guido van Rossum
On Wed, Apr 2, 2008 at 6:30 AM, Nick Coghlan <[EMAIL PROTECTED]> wrote: > One of the issues with porting to Py3k is the problem that __getattr__ > and __getattribute__ can't reliably provide special methods like __add__ > the way __getattr__ could with classic classes. (As first noted by Terry >

Re: [Python-3000] Method to populate tp_* slots via getattr()?

2008-04-02 Thread Adam Olsen
On Wed, Apr 2, 2008 at 7:30 AM, Nick Coghlan <[EMAIL PROTECTED]> wrote: > One of the issues with porting to Py3k is the problem that __getattr__ > and __getattribute__ can't reliably provide special methods like __add__ > the way __getattr__ could with classic classes. (As first noted by Terry >

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Alex Martelli
On Tue, Apr 1, 2008 at 11:39 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: ... > > keys = mydict.keys() > > keys.sort() > > for key in keys: > > That is indeed a frequent case in 2.x. Fortunately, it is what David > calls "loud" breakage: > > py> keys = mydict.keys() > py> keys.sort()

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Christian Heimes
Michael Urman schrieb: > for i, k in enumerate(d.keys()): > if i % 2: del d[k] > > If this code works as is in py3k, I have no concerns over whether > keys(), etc., return snapshots or live views. If this code instead > requires the snapshot that list(d) or list(d.keys()) provides, the

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Antoine Pitrou
Michael Urman gmail.com> writes: > The biggest concern I have is over whether the following works: > > for i, k in enumerate(d.keys()): > if i % 2: del d[k] > Well: Python 3.0a3+ (py3k, Mar 30 2008, 21:14:40) [GCC 4.2.3 (4.2.3-5mnb1)] on linux2 Type "help", "copyright", "credits"

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Facundo Batista
2008/4/2, David Pokorny <[EMAIL PROTECTED]>: > describe, but I don't understand why the behavior of the most common > name should be the most efficient implementation of the most common > scenario. One could propose an alternate policy: the behavior of the Half of the magic power of Python, IM

Re: [Python-3000] Spooky behavior of dict.items() and friends

2008-04-02 Thread Michael Urman
On Wed, Apr 2, 2008 at 1:39 AM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > I'd say not clear, for two reasons. One is that I pretty much never > > use keys() in a for loop, I just use the dictionary. > > Ok. Consider items() then. Again, I claim that the common use of > items() is to iterate

[Python-3000] Method to populate tp_* slots via getattr()?

2008-04-02 Thread Nick Coghlan
One of the issues with porting to Py3k is the problem that __getattr__ and __getattribute__ can't reliably provide special methods like __add__ the way __getattr__ could with classic classes. (As first noted by Terry Reedy years ago, and recently seeing some new activity on the bug tracker [1])

Re: [Python-3000] the release gods are angry at python

2008-04-02 Thread Amaury Forgeot d'Arc
On Wed, Apr 2, 2008 at 9:58 AM, Trent Nelson <[EMAIL PROTECTED]> wrote: > > > In the py3k branch I've assigned the audio resource to the winsound > > > tests. Only regrtest.py -uall or -uaudio runs the winsound test. > > Reason: > > > the test sound was freaking out my poor cat. :/ > > > > I f

Re: [Python-3000] the release gods are angry at python

2008-04-02 Thread Trent Nelson
> > In the py3k branch I've assigned the audio resource to the winsound > > tests. Only regrtest.py -uall or -uaudio runs the winsound test. > Reason: > > the test sound was freaking out my poor cat. :/ > > I feel with your cat ;-). > This would not help on the buildbot since it runs 'rt.bat -d -q

Re: [Python-3000] IO __all__

2008-04-02 Thread Brett Cannon
On Wed, Apr 2, 2008 at 4:36 AM, Benjamin Peterson <[EMAIL PROTECTED]> wrote: > > > > On Tue, Apr 1, 2008 at 6:43 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > Well, it *is* part of the public interface of io.py, and it *is* the > > implementation of the built-in open() function. So I don't th