[Python-Dev] Evil isinstance()
Mon, 1 Apr 2002 02:30:02 +0200
From: Guido van Rossum <firstname.lastname@example.org>
> > > This leaves me in the uncomfortable position that I don't know
> > > what to recommend. :-(
> > In your shoes, I'd recommend PEP 246 -- since, if I were in your
> > shoes, I'd have approved it long ago. (We don't need to have
> > interfaces as a distinct concept from types/classes to approve PEP
> > 246 -- any types can serve as 'protocols' to make PEP 246 a
> > reality). It would offer a very good solution to problems in this
> > category, in my opinion.
> Maybe you can summarize it again using a different vocabulary? I find
> that PEP very hard to read, but I recall liking your informal
> explanation of it. Unfortunately I don't recall enough of that
> explanation to go ahead and approve the PEP (I have no idea what
> effect that would have).
It's a tool, IMHO what is missing is a common dictionary of protocols
and idioms, Alex says we don't need that, just let people
have the tool and be inspired by other frameworks.
E.g. how should one spell the example test:
# but then what about unicode and should str have
# an __adapt__ ?
but then should every one define his StringLike,
or should the std lib define one, should StringLike
__conform__ use the +'' trick or not.
Further the PEP suggests that a global
registry for 3rd part adaptations would be useful
(and give more degree-of-freedom to cope
with the above issues)
but it does not specify it, it specify just a global
__import__-like hook for adaptation,
but __import__ problems suggest that is not
a valid solution...
regards, Samuele Pedroni.