Re: [Python-Dev] Language reference updated for metaclasses

2012-06-05 Thread Nick Coghlan
On Tue, Jun 5, 2012 at 6:34 PM, Mark Shannon wrote: > In this example the metaclass (ie the class of C) is type (C is int), > even though the declared metaclass is 'silly'. > > I assume it is too late to change the name of the 'metaclass' keyword to > 'factory', but we could use that terminology i

Re: [Python-Dev] Language reference updated for metaclasses

2012-06-05 Thread Michael Foord
On 5 Jun 2012, at 09:34, Mark Shannon wrote: > Steven D'Aprano wrote: >> On Tue, Jun 05, 2012 at 10:20:58AM +0300, Eli Bendersky wrote: >>> Still, instance of type()" is a bit too cryptic for mere mortals, IMHO. >> I think that if somebody finds "instance of type" too cryptic, they won't >> have

Re: [Python-Dev] Language reference updated for metaclasses

2012-06-05 Thread Mark Shannon
Steven D'Aprano wrote: On Tue, Jun 05, 2012 at 10:20:58AM +0300, Eli Bendersky wrote: Still, instance of type()" is a bit too cryptic for mere mortals, IMHO. I think that if somebody finds "instance of type" too cryptic, they won't have any chance at all to understand metaclasses. Personal

Re: [Python-Dev] Language reference updated for metaclasses

2012-06-05 Thread Steven D'Aprano
On Tue, Jun 05, 2012 at 10:20:58AM +0300, Eli Bendersky wrote: > Still, instance of type()" is a bit too cryptic for mere mortals, IMHO. I think that if somebody finds "instance of type" too cryptic, they won't have any chance at all to understand metaclasses. Personally, I think there is a lot

Re: [Python-Dev] Language reference updated for metaclasses

2012-06-05 Thread Eli Bendersky
On Tue, Jun 5, 2012 at 10:18 AM, Nick Coghlan wrote: > On Tue, Jun 5, 2012 at 1:24 PM, Eli Bendersky wrote: >> >> "if an explicit metaclass is given and it is not an instance of >> type(), then it is used directly as the metaclass" >> >> Could you elaborate on this point? Would it perhaps be clea

Re: [Python-Dev] Language reference updated for metaclasses

2012-06-05 Thread Nick Coghlan
On Tue, Jun 5, 2012 at 1:24 PM, Eli Bendersky wrote: > > "if an explicit metaclass is given and it is not an instance of > type(), then it is used directly as the metaclass" > > Could you elaborate on this point? Would it perhaps be clearer to say > "if an explicit metaclass is given and it is not

Re: [Python-Dev] Language reference updated for metaclasses

2012-06-04 Thread Eli Bendersky
On Sun, May 20, 2012 at 10:38 AM, Nick Coghlan wrote: > When writing the docs for types.new_class(), I discovered that the > description of the class creation process in the language reference > was not only hard to follow, it was actually *incorrect* when it came > to describing the algorithm for

Re: [Python-Dev] Language reference updated for metaclasses

2012-06-04 Thread PJ Eby
On Mon, Jun 4, 2012 at 6:15 PM, Nick Coghlan wrote: > It's actually the pre-decoration class, since the cell is initialised > before the class is passed to the first decorator. I agree it's a little > weird, but I did try to describe it accurately in the new docs. > I see that now; it might be he

Re: [Python-Dev] Language reference updated for metaclasses

2012-06-04 Thread PJ Eby
On Sun, May 20, 2012 at 4:38 AM, Nick Coghlan wrote: > When writing the docs for types.new_class(), I discovered that the > description of the class creation process in the language reference > was not only hard to follow, it was actually *incorrect* when it came > to describing the algorithm for

Re: [Python-Dev] Language reference updated for metaclasses

2012-06-04 Thread Nick Coghlan
It's actually the pre-decoration class, since the cell is initialised before the class is passed to the first decorator. I agree it's a little weird, but I did try to describe it accurately in the new docs. -- Sent from my phone, thus the relative brevity :) On Jun 5, 2012 7:52 AM, "PJ Eby" wrote

Re: [Python-Dev] Language reference updated for metaclasses

2012-05-20 Thread Daniel Urban
I think there is a small mistake in section "3.3.3.4. Creating the class object": "After the class object is created, any class decorators included in the *function* definition are invoked ..." That probaly should be "class definition". Daniel ___ Pytho

[Python-Dev] Language reference updated for metaclasses

2012-05-20 Thread Nick Coghlan
When writing the docs for types.new_class(), I discovered that the description of the class creation process in the language reference was not only hard to follow, it was actually *incorrect* when it came to describing the algorithm for determining the correct metaclass. I rewrote the offending se