List Info

Thread: Re: PEP 367: New Super




Re: PEP 367: New Super
country flaguser name
Australia
2007-05-20 01:44:03
Tim Delaney wrote:
> Phillip J. Eby wrote:
>> At 05:23 PM 5/14/2007 +1000, Tim Delaney wrote:
>>> Determining the class object to use
>>> '''''''''''''''''''''''''''''''''''
>>>
>>> The exact mechanism for associating the method
with the defining
>>> class is not
>>> specified in this PEP, and should be chosen for
maximum performance.
>>> For CPython, it is suggested that the class
instance be held in a
>>> C-level variable
>>> on the function object which is bound to one of
``NULL`` (not part
>>> of a class),
>>> ``Py_None`` (static method) or a class object
(instance or class
>>> method).
>>
>> Another open issue here: is the decorated class
used, or the
>> undecorated class?
>
> Sorry I've taken so long to get back to you about this
- had email
> problems.
> I'm not sure what you're getting at here - are you
referring to the
> decorators for classes PEP? In that case, the decorator
is applied
> after the class is constructed, so it would be the
undecorated class.
>
> Are class decorators going to update the MRO? I see
nothing about
> that in PEP 3129, so using the undecorated class would
match the
> current super(cls, self) behaviour.

Duh - I'm an idiot. Of course, the current behaviour uses
name lookup, so it 
would use the decorated class.

So the question is, should the method store the class, or
the name? Looking 
up by name could pick up a totally unrelated class, but
storing the 
undecorated class could miss something important in the
decoration.

Tim Delaney 

_______________________________________________
Python-Dev mailing list
Python-Devpython.org
ht
tp://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/p
ython-dev/nessto%40sharedlog.com

Re: PEP 367: New Super
country flaguser name
Australia
2007-05-20 02:42:22
Tim Delaney wrote:
> So the question is, should the method store the class,
or the name? Looking 
> up by name could pick up a totally unrelated class, but
storing the 
> undecorated class could miss something important in the
decoration.

Couldn't we provide a mechanism whereby the cell can be
adjusted to 
point to the decorated class? (heck, the interpreter has
access to both 
classes after execution of the class statement - it could
probably 
arrange for this to happen automatically whenever the
decorated and 
undecorated classes are different).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlangmail.com   |   Brisbane,
Australia
------------------------------------------------------------
---
             http://www.boredoma
ndlaziness.org
_______________________________________________
Python-Dev mailing list
Python-Devpython.org
ht
tp://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/p
ython-dev/nessto%40sharedlog.com

Re: PEP 367: New Super
country flaguser name
Australia
2007-05-20 03:20:37
Nick Coghlan wrote:
> Tim Delaney wrote:
>> So the question is, should the method store the
class, or the name?
>> Looking up by name could pick up a totally
unrelated class, but
>> storing the undecorated class could miss something
important in the
>> decoration. 
> 
> Couldn't we provide a mechanism whereby the cell can be
adjusted to
> point to the decorated class? (heck, the interpreter
has access to
> both classes after execution of the class statement -
it could
> probably arrange for this to happen automatically
whenever the
> decorated and undecorated classes are different).

Yep - I thought of that. I think that's probably the right
way to go.

Tim Delaney
_______________________________________________
Python-Dev mailing list
Python-Devpython.org
ht
tp://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/p
ython-dev/nessto%40sharedlog.com

Re: PEP 367: New Super
country flaguser name
United States
2007-05-20 19:11:24
At 06:20 PM 5/20/2007 +1000, Tim Delaney wrote:
>Nick Coghlan wrote:
> > Tim Delaney wrote:
> >> So the question is, should the method store
the class, or the name?
> >> Looking up by name could pick up a totally
unrelated class, but
> >> storing the undecorated class could miss
something important in the
> >> decoration.
> >
> > Couldn't we provide a mechanism whereby the cell
can be adjusted to
> > point to the decorated class? (heck, the
interpreter has access to
> > both classes after execution of the class
statement - it could
> > probably arrange for this to happen automatically
whenever the
> > decorated and undecorated classes are different).
>
>Yep - I thought of that. I think that's probably the
right way to go.

Btw, PEP 3124 needs a way to receive the same class object
at more or 
less the same moment, although in the form of a callback
rather than 
a cell assignment.  Guido suggested I co-ordinate with you
to design 
a mechanism for this.


_______________________________________________
Python-Dev mailing list
Python-Devpython.org
ht
tp://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/p
ython-dev/nessto%40sharedlog.com

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )