[Python-Dev] C-level duck typing (original) (raw)
Dag Sverre Seljebotn d.s.seljebotn at astro.uio.no
Fri May 18 10:30:14 CEST 2012
- Previous message: [Python-Dev] C-level duck typing
- Next message: [Python-Dev] C-level duck typing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 05/18/2012 12:57 AM, Nick Coghlan wrote:
I think the main things we'd be looking for would be: - a clear explanation of why a new metaclass is considered too complex a solution - what the implications are for classes that have nothing to do with the SciPy/NumPy ecosystem - how subclassing would behave (both at the class and metaclass level)
Yes, defining a new metaclass for fast signature exchange has its challenges - but it means that our concerns about maintaining consistent behaviour in the default object model and avoiding adverse effects on code that doesn't need the new behaviour are addressed automatically. Also, I'd consider a functioning reference implementation using a custom metaclass a requirement before we considered modifying type anyway, so I think that's the best thing to pursue next rather than a PEP. It also has the virtue of letting you choose which Python versions to target and iterating at a faster rate than CPython.
This seems right on target. I could make a utility code C header for such a metaclass, and then the different libraries can all include it and handshake on which implementation becomes the real one through sys.modules during module initialization. That way an eventual PEP will only be a natural incremental step to make things more polished, whether that happens by making such a metaclass part of the standard library or by extending PyTypeObject.
Thanks,
Dag
- Previous message: [Python-Dev] C-level duck typing
- Next message: [Python-Dev] C-level duck typing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]