[Cython] [Python-Dev] C-level duck typing

Robert Bradshaw robertwb at gmail.com
Thu May 31 20:22:18 CEST 2012


On Thu, May 31, 2012 at 7:20 AM, Dag Sverre Seljebotn
<d.s.seljebotn at astro.uio.no> wrote:
>
> SEP updated (to what I hope is the final form):
>
> https://groups.google.com/forum/?fromgroups#!topic/numfocus/-XWwLMVgXBQ
> https://github.com/numfocus/sep/blob/master/sep200.rst
> https://github.com/dagss/pyextensibletype

Very nice!

> Changes:
>
>  - Remove the flags concept; option a) above
>
>  - Use the tp_flags bit. (I benchmarked walking the type hierarchy, and it
> doesn't cost if you don't take the branch, but I'm much happier for clients
> to avoid having to rendezvous on the metaclass, in particular if this is
> used in the NumPy API).
>
>  - All manually allocated IDs have the least significant bit set, so that
> one can also use 2-byte aligned pointers as IDs (e.g., objects representing
> interfaces or interned strings can be used as slot IDs).


More information about the cython-devel mailing list