Re: [Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-18 Thread Guido van Rossum
On 3/14/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 3/14/07, Talin <[EMAIL PROTECTED]> wrote: > > PEP: xxx > > Title: Metaclasses in Python 3000 > > Checked in as PEP 3115. I've accepted this PEP and checked in the implementation. The compiler package is currently broken; someone who know

Re: [Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-15 Thread Greg Ewing
Phillip J. Eby wrote: > > Maybe the PEP should specify a protocol that the > > pseudo-dict must provide for doing this, such as an > > iteritems() method (or whatever the Py3k equivalent > > is). > > That's not necessary; the metaclass instance __call__ (or class __new__) > should be responsible

Re: [Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-15 Thread Guido van Rossum
On 3/15/07, Talin <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > While you're at it, could you also add a pointer to this patch as a > > sample implementation? > > > > http://python.org/sf/1681101 > > That is way cool. It is now way cooler -- it *works*! The build_class function is imple

Re: [Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-15 Thread Phillip J. Eby
At 12:13 PM 3/15/2007 +1300, Greg Ewing wrote: >Phillip J. Eby wrote: > > > So the subset required is determined entirely by what the class body > > (and metaclass __new__) require. > >Perhaps the PEP should say something to the effect that >get, set and delete need to be implemented in order to >s

Re: [Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-15 Thread Talin
Guido van Rossum wrote: > While you're at it, could you also add a pointer to this patch as a > sample implementation? > > http://python.org/sf/1681101 > > It's far from complete at this point; so far, I've got the syntax > working and it seems to compile old code just fine, but the keyword > arg

Re: [Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-14 Thread Guido van Rossum
While you're at it, could you also add a pointer to this patch as a sample implementation? http://python.org/sf/1681101 It's far from complete at this point; so far, I've got the syntax working and it seems to compile old code just fine, but the keyword args and */** notation are simply ignored.

Re: [Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-14 Thread Greg Ewing
Phillip J. Eby wrote: > So the subset required is determined entirely by what the class body > (and metaclass __new__) require. Perhaps the PEP should say something to the effect that get, set and delete need to be implemented in order to support all the things the class body might want to do, b

Re: [Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-14 Thread Phillip J. Eby
At 11:15 AM 3/14/2007 -0700, Guido van Rossum wrote: >I think this rebuttal isn't strong enough; I'm sure there *will* be >use cases where a custom prepare method can solve a problem that a >standard ordered dict couldn't. For example, a custom prepare could provide access to special method names

Re: [Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-14 Thread Talin
Guido van Rossum wrote: > On 3/14/07, Talin <[EMAIL PROTECTED]> wrote: >> PEP: xxx >> Title: Metaclasses in Python 3000 > > Checked in as PEP 3115. I fixed the two typos that were noted so far > (missing comma and inconsistency in name of first arg to __prepare__; > I renamed the latter metacls) a

Re: [Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-14 Thread Guido van Rossum
On 3/14/07, Talin <[EMAIL PROTECTED]> wrote: > PEP: xxx > Title: Metaclasses in Python 3000 Checked in as PEP 3115. I fixed the two typos that were noted so far (missing comma and inconsistency in name of first arg to __prepare__; I renamed the latter metacls) and cleaned up one case of extra whit

Re: [Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-14 Thread Jack Diederich
On Wed, Mar 14, 2007 at 12:29:09AM -0700, Talin wrote: > # The metaclass > class OrderedClass(type): > > # The custom dictionary > class member_table(dict): I would move the member_table class out of the OrderedClass namespace so no one gets any funny ideas that it ha

Re: [Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-14 Thread Steven Bethard
On 3/14/07, Talin <[EMAIL PROTECTED]> wrote: > PEP: xxx > Title: Metaclasses in Python 3000 Looks good. > # The metaclass > class OrderedClass(type): > > # The custom dictionary > class member_table(dict): > def __init__(self): >self.member_

Re: [Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-14 Thread Phillip J. Eby
At 08:49 PM 3/14/2007 +1300, Greg Ewing wrote: >Talin wrote: > > It does not need to implement the full dictionary interface; > > only the ability to insert items and retrieve them are > > required. (Note: double check that this is true). > >Deletion ability might be required as well

Re: [Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-13 Thread Greg Ewing
Talin wrote: > It does not need to implement the full dictionary interface; > only the ability to insert items and retrieve them are > required. (Note: double check that this is true). Deletion ability might be required as well, in case del is used in the class body. -- Greg __

[Python-3000] Metaclasses in Python 3000: Draft 2

2007-03-13 Thread Talin
PEP: xxx Title: Metaclasses in Python 3000 Version: $Revision$ Last-Modified: $Date$ Author: Talin Status: Draft Type: Standards Content-Type: text/plain Created: 07-Mar-2007 Python-Version: 3.0 Post-History: 11-March-2007 Abstract This PEP proposes changing the syntax for declaring metacl