Re: [Python-Dev] Metaclass problem in the "with" statement semantics in PEP 343

2005-11-30 Thread Nick Coghlan
Edward Loper wrote: > Otherwise, it seems like people might write code that relies on the > current behavior, which will then break if we eg turn __context__ into > a slot. (It sounds like you want to reserve the right to change this.) > Well, of course, people may rely on the current behavio

Re: [Python-Dev] Metaclass problem in the "with" statement semantics in PEP 343

2005-11-29 Thread Edward Loper
Michael Chermside wrote: >> Right now, we say that there's one rule for all *normal* attributes >> and >> methods, and a slightly different rule for all double-underbar >> methods. Guido responded: > But it's not normal vs. __xyzzy__. A specific set of slots (including > next, but excluding thin

Re: [Python-Dev] Metaclass problem in the "with" statement semantics in PEP 343

2005-11-29 Thread Guido van Rossum
On 11/29/05, Michael Chermside <[EMAIL PROTECTED]> wrote: > Right now, we say that there's one rule for all *normal* attributes and > methods, and a slightly different rule for all double-underbar methods. But it's not normal vs. __xyzzy__. A specific set of slots (including next, but excluding th

Re: [Python-Dev] Metaclass problem in the "with" statement semantics in PEP 343

2005-11-29 Thread Guido van Rossum
On 11/29/05, Nick Coghlan <[EMAIL PROTECTED]> wrote: > The bit that more concerns me is the behavioural discrepancy that comes from > having a piece of syntax that looks in the instance dictionary. No other > Python syntax is affected by the instance attributes - if the object doesn't > have the ri

Re: [Python-Dev] Metaclass problem in the "with" statement semantics in PEP 343

2005-11-29 Thread Michael Chermside
Nick writes: > I think we need to fix the proposed semantics so that they access the slots > via the type, rather than directly through the instance. Otherwise the slots > for the with statement will behave strangely when compared to the slots for > other magic methods. Guido writes: > I can't mak

Re: [Python-Dev] Metaclass problem in the "with" statement semantics in PEP 343

2005-11-29 Thread Nick Coghlan
Guido van Rossum wrote: > On 11/28/05, Nick Coghlan <[EMAIL PROTECTED]> wrote: >> I think we need to fix the proposed semantics so that they access the slots >> via the type, rather than directly through the instance. Otherwise the slots >> for the with statement will behave strangely when compared

Re: [Python-Dev] Metaclass problem in the "with" statement semantics in PEP 343

2005-11-28 Thread Guido van Rossum
On 11/28/05, Nick Coghlan <[EMAIL PROTECTED]> wrote: > Given the current semantics of PEP 343 and the following class: > >class null_context(object): > def __context__(self): > return self > def __enter__(self): > return self > def __exit__(self, *exc_info): >