[Cython] Hello

John Skaller2 skaller at internode.on.net
Tue Jan 28 14:37:41 EST 2020


So I just had a thought, I might try something to enhance the bindings.
Not sure if it will work. 

My system supports subtyping. For bindings and other nominal types
you can simple define a subtyping coercion.

Now in Python we have subtyping rules like:

dictionary -> mapping -> object

If I implement that with just static casts for coercions, then say,
given a dictionary and a function accepting a mapping argument,
you can pass a dictionary or mapping, but not an object.
If you want to pass an object you have to explicitly coerce it.

The *problem* with this idea I think is that from memory the reference counting
rules for PyObject and dictionaries are not the same as for methods
on abstractions. 

Cython must do something like this, right? And get the ref counting right.


—
John Skaller
skaller at internode.on.net







More information about the cython-devel mailing list