[Python-3000] Adaptation vs. Generic Functions (original) (raw)
Phillip J. Eby pje at telecommunity.com
Fri Apr 7 18:40:16 CEST 2006
- Previous message: [Python-3000] Adaptation vs. Generic Functions
- Next message: [Python-3000] Adaptation vs. Generic Functions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 07:37 AM 4/7/2006, Jim Jewett wrote:
On 4/7/06, Phillip J. Eby <pje at telecommunity.com> wrote: > Guido wrote: > > mros = tuple(t.mro for t in types) > > n = len(mros) > > candidates = [sig for sig in self.registry > > if len(sig) == n and > > all(t in mro for t, mro in zip(sig, mros))] > > I believe this can be simplified to: > n = len(types) > candidates = [sig for sig in self.registry > if len(sig) == n and > all(issubclass(s,t) for s,t in zip(sig, types))]
Am I going nuts, or should that issubclass test be reversed?
No, you're right, I goofed. To me, the "signature" was what the function was called with, so it seemed to read correctly to me. i.e., I read it as "the calling signature item is a subclass of the target method's type"... which is the right idea, but the wrong variables. :)
- Previous message: [Python-3000] Adaptation vs. Generic Functions
- Next message: [Python-3000] Adaptation vs. Generic Functions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]