[Python-Dev] Re: PEP 246: LiskovViolation as a name
Alex Martelli
aleax at aleax.it
Thu Jan 13 09:00:19 CET 2005
On 2005 Jan 13, at 02:18, Phillip J. Eby wrote:
> At 05:54 PM 1/12/05 -0700, Steven Bethard wrote:
>> Not that my opinion counts for much =), but returning None does seem
>> much simpler to me. I also haven't seen any arguments against this
>> route of handling protocol nonconformance... Is there a particular
>> advantage to the exception-raising scheme?
>
> Only if there's any objection to giving the 'object' type a default
> __conform__ method that returns 'self' if
> 'isinstance(protocol,ClassTypes) and isinstance(self,protocol)'.
In the spirit of minimalism in which I propose to rewrite PEP 246 (as
per my latest post: make a simple, noninvasive, unassuming PEP 246
while new ``copernical revolution'' ideas which you proposed mature in
another PEP), I'd rather not make a change to built-in ``object'' a
prereq for PEP 246; so, I think the reference implementation should
avoid assuming such changes, if it's at all possible to avoid them
(while, no doubt, indicating the desirability of such changes for
simplification and acceleration).
Incidentally, "get this specialmethod from the type (with specialcasing
for classic classes &c)" is a primitive that PEP 246 needs as much as,
say, copy.py needs it. In the light of the recent discussions of how
to fix copy.py etc, I'm unsure about what to assume there, in a rewrite
of PEP 246: that getattr(obj, '__aspecial__', None) always does the
right thing via special descriptors, that I must spell everything out,
or, what else...?
If anybody has advice or feedback on these points, it will be welcome!
Alex
More information about the Python-Dev
mailing list