[Python-3000] metaclass syntax [was: Discussions with no PEPs]

2007-03-09 Thread Jim Jewett
On 3/8/07, Talin <[EMAIL PROTECTED]> wrote: > First, there is a purely cosmetic argument about how metaclasses ought > to be specified syntactically, which I won't go into in any detail. Most > of the proposals centered around what I will call 'Class Definition > Keyword Arguments' (CDKA), in othe

Re: [Python-3000] metaclass syntax [was: Discussions with no PEPs]

2007-03-09 Thread Guido van Rossum
Those look like use cases for metaclasses, but I don't see how they require setting a custom dict *while the class suite is being executed*. The metaclass can create a new dict from its dict argument and use the new dict to construct the class. On 3/9/07, Jim Jewett <[EMAIL PROTECTED]> wrote: > On

Re: [Python-3000] metaclass syntax [was: Discussions with no PEPs]

2007-03-09 Thread Phillip J. Eby
At 07:06 AM 3/9/2007 -0800, Guido van Rossum wrote: >Those look like use cases for metaclasses, but I don't see how they >require setting a custom dict *while the class suite is being >executed*. The main use case for that is to know what order the items were defined in; currently there's no way

Re: [Python-3000] metaclass syntax [was: Discussions with no PEPs]

2007-03-09 Thread Guido van Rossum
On 3/9/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 07:06 AM 3/9/2007 -0800, Guido van Rossum wrote: > >Those look like use cases for metaclasses, but I don't see how they > >require setting a custom dict *while the class suite is being > >executed*. > > The main use case for that is to know

Re: [Python-3000] Discussions with no PEPs

2007-03-09 Thread Bill Janssen
> Bill Janssen wrote: > > Calling a method on an object doesn't seem like duck-typing to > > me, though. > > It's duck typing in the sense that you don't have to > formally declare the object as conforming to some > interface before you can call the method. Oh, OK. I'm against (mandatory) type d

[Python-3000] generics [was: Discussions with no PEPs]

2007-03-09 Thread Talin
Here's my proposal for what additional work should be done with respect to generic functions in Python 3000. 1) In the Python 3000 branch, do nothing at the current time. The 3.0 branch already has sufficient hooks to allow 3rd-party developers to create their own generic function implementatio

[Python-3000] PEP for Metaclasses in Python 3000

2007-03-09 Thread Talin
I had a conversation with Guido last night at the Python user's group meeting, and we hashed out some of the details of how metaclasses should work. I've gone ahead and written up a PEP, which I present for your review. PEP: xxx Title: Metaclasses in P

Re: [Python-3000] PEP Draft: Class Decorators

2007-03-09 Thread Brett Cannon
On 2/28/07, Collin Winter <[EMAIL PROTECTED]> wrote: > On 2/28/07, Jack Diederich <[EMAIL PROTECTED]> wrote: > [snip] > > History and Implementation > > == > > > > Class decorators were originally proposed in PEP318 [1]_ and were rejected > > by Guido [2]_ for lack of use ca

Re: [Python-3000] PEP for Metaclasses in Python 3000

2007-03-09 Thread Steven Bethard
On 3/9/07, Talin <[EMAIL PROTECTED]> wrote: > PEP: xxx > Title: Metaclasses in Python 3000 Thanks for writing this. > This attribute is a method named __metacreate__, which is invoked > before the evaluation of the class body, and which has the > following form: > > classdict

Re: [Python-3000] PEP for Metaclasses in Python 3000

2007-03-09 Thread Brett Cannon
On 3/9/07, Talin <[EMAIL PROTECTED]> wrote: > I had a conversation with Guido last night at the Python user's group > meeting, and we hashed out some of the details of how metaclasses should > work. I've gone ahead and written up a PEP, which I present for your review. > ---

Re: [Python-3000] generics [was: Discussions with no PEPs]

2007-03-09 Thread Tony Lownds
On Mar 9, 2007, at 11:36 AM, Talin wrote: > 2) Backport the argument annotations patch to the 2.X series and > get it > out to the public as quickly as possible. (According to the > conversation > I had with Guido, this should be relatively easy since the annotations > patch was one of the fir

Re: [Python-3000] [Python-Dev] Policy Decisions, Judgment Calls, and Backwards Compatibility (was Re: splitext('.cshrc'))

2007-03-09 Thread Patrick Maupin
On 3/9/07, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 07:18 PM 3/9/2007 +0100, Martin v. Löwis wrote: > >Phillip J. Eby schrieb: > The only group the change benefits is people writing *new* code -- so give > them a new function. Actually, it's worse than that. The only group the change benefi

Re: [Python-3000] generics [was: Discussions with no PEPs]

2007-03-09 Thread Guido van Rossum
On 3/9/07, Tony Lownds <[EMAIL PROTECTED]> wrote: > > On Mar 9, 2007, at 11:36 AM, Talin wrote: > > 2) Backport the argument annotations patch to the 2.X series and > > get it > > out to the public as quickly as possible. (According to the > > conversation > > I had with Guido, this should be relat

Re: [Python-3000] generics [was: Discussions with no PEPs]

2007-03-09 Thread Collin Winter
On 3/9/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 3/9/07, Tony Lownds <[EMAIL PROTECTED]> wrote: > > > > On Mar 9, 2007, at 11:36 AM, Talin wrote: > > > 2) Backport the argument annotations patch to the 2.X series and > > > get it > > > out to the public as quickly as possible. (According

Re: [Python-3000] Cross-compatibility with 2.6 and 3.0

2007-03-09 Thread Thomas Wouters
On 3/9/07, Talin <[EMAIL PROTECTED]> wrote: "It is unlikely that you will be able to write both code that is both valid Python 2.6 source code and valid Python 3.0 source code". Please see http://mail.python.org/pipermail/python-dev/2007-February/071372.html (and subsequent messages, if you w

Re: [Python-3000] PEP Draft: Class Decorators

2007-03-09 Thread Jack Diederich
On Fri, Mar 09, 2007 at 01:21:49PM -0800, Brett Cannon wrote: > On 2/28/07, Collin Winter <[EMAIL PROTECTED]> wrote: > >On 2/28/07, Jack Diederich <[EMAIL PROTECTED]> wrote: > >[snip] > >> History and Implementation > >> == > >> > >> Class decorators were originally proposed

Re: [Python-3000] generics [was: Discussions with no PEPs]

2007-03-09 Thread Tony Lownds
On Mar 9, 2007, at 2:35 PM, Guido van Rossum wrote: > On 3/9/07, Tony Lownds <[EMAIL PROTECTED]> wrote: >> With tuple parameters removed, there would still be divergence in >> 2.X. > > But not much; we could drop the annotation feature for tuple > parameters (since it won't survive in 3.0) and w

Re: [Python-3000] PEP Draft: Class Decorators

2007-03-09 Thread Jack Diederich
I got lots of feedback on the PEP at PyCon and the two main responses were "heck yeah!" and "what does a class decorator look like?" I've added some simple examples for the "what is?" and some other examples that should help explain the "heck yeah" responses too. I'm cc'ing [EMAIL PROTECTED] for

Re: [Python-3000] PEP Draft: Class Decorators

2007-03-09 Thread Collin Winter
You need to run this through a spellchecker; I noticed at least a dozen typos. Other comments inline. Collin Winter On 3/9/07, Jack Diederich <[EMAIL PROTECTED]> wrote: > PEP: 3XXX > Title: Class Decorators > Version: 1 > Last-Modified: 28-Feb-2007 > Authors: Jack Diederich > Implementation: SF#1

Re: [Python-3000] PEP for Metaclasses in Python 3000

2007-03-09 Thread Jack Diederich
On Fri, Mar 09, 2007 at 12:44:36PM -0800, Talin wrote: > I had a conversation with Guido last night at the Python user's group > meeting, and we hashed out some of the details of how metaclasses should > work. I've gone ahead and written up a PEP, which I present for your review. > --

Re: [Python-3000] Discussions with no PEPs

2007-03-09 Thread Greg Ewing
Bill Janssen wrote: > Oh, OK. I'm against (mandatory) type declarations. However, I do > believe that the object's type should have to include the expected > interface for the method invocation to succeed. I don't understand what you mean by that. If there is no formal embodiment of interfaces,

Re: [Python-3000] PEP Draft: Class Decorators

2007-03-09 Thread Jack Diederich
On Fri, Mar 09, 2007 at 06:19:49PM -0600, Collin Winter wrote: > >History and Implementation > >== > > > >Class decorators were originally proposed alongside function decorators > >in PEP318 [1]_ and were rejected by Guido [2]_ for lack of use cases. > >Two years later he sa

Re: [Python-3000] generics [was: Discussions with no PEPs]

2007-03-09 Thread Greg Ewing
Talin wrote: > 3) At some point, pick the best / most popular generic function package > and formally make it a part of Python 3. Shouldn't there be 2.5) At some point, decide whether we want generic functions as a formal feature at all. -- Greg _

Re: [Python-3000] PEP Draft: Class Decorators

2007-03-09 Thread Brett Cannon
[SNIP] > class FormFactory(Form): > id_to_form = {} # { account_id : { form_id : form_class } } > @staticmethod > def register(cls, account_id, form_id): > FormFactory.id_to_form.setdefault(cls.account_id, {}) > assert form_id not in FormFactory.id_to_form[cls.account_id

Re: [Python-3000] PEP for Metaclasses in Python 3000

2007-03-09 Thread Greg Ewing
Talin wrote: >class Foo(base1, base2, metaclass=mymeta): > ... -1 on this syntax, I think it's ugly. Alternative proposals: class Foo(base1, base2) as MyMeta: ... or class Foo(base1, base2) = MyMeta: ... >class Foo(base1, base2, metaclass=mymeta, priv

Re: [Python-3000] PEP for Metaclasses in Python 3000

2007-03-09 Thread Greg Ewing
Jack Diederich wrote: > I am a very big fan of ordered dicts in classes. One possibility is that > suites in classes always store their order in a special dict that keeps a > side list of key order. A final invisible class decorator around > every class would then toss out the order and leave o

Re: [Python-3000] __methods__ and __members__

2007-03-09 Thread Georg Brandl
Guido van Rossum schrieb: > I don't recall ripping them out, but it's worth trying to do that -- > they really shouldn't be needed for modern extensionmodules (2.2+). > > On 3/7/07, Georg Brandl <[EMAIL PROTECTED]> wrote: >> While reviewing the patch for __dir__() (which I'll apply then, since it