Re: [Cython] Hello

2020-01-28 Thread John Skaller2
> > For your system, you may need a way of annotating function > declarations with refcounting rules where they differ from > the defaults. Yeah, and i have to encode that to some extent in the type system. However I have two techs to play with: Felix and C++. Both can, for example, do subtyping

Re: [Cython] Hello

2020-01-28 Thread Greg Ewing
On 29/01/20 8:37 am, John Skaller2 wrote: 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.

Re: [Cython] Hello

2020-01-28 Thread Greg Ewing
On 29/01/20 1:33 am, John Skaller2 wrote: # This conflicts with the C++ bool type, and unfortunately # C++ is too liberal about PyObject* <-> bool conversions, # resulting in unintuitive runtime behavior and segfaults. #("bool","PyBool_Type", []), Now you have me worried! Any more

Re: [Cython] Hello

2020-01-28 Thread John Skaller2
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 impl

Re: [Cython] Hello

2020-01-28 Thread John Skaller2
> On 28 Jan 2020, at 21:07, Stefan Behnel wrote: > > John Skaller2 schrieb am 28.01.20 um 10:57: >> What’s a “descr” when its at home? > > A descriptor, a special protocol in Python. > > https://docs.python.org/3/howto/descriptor.html Got it, thanks! > >> There are some special words in px

Re: [Cython] Hello

2020-01-28 Thread Stefan Behnel
John Skaller2 schrieb am 28.01.20 um 10:57: > What’s a “descr” when its at home? A descriptor, a special protocol in Python. https://docs.python.org/3/howto/descriptor.html > There are some special words in pxd files like “list” which mean > PyObject that happens to be a list. Is there a list o

Re: [Cython] Hello

2020-01-28 Thread John Skaller2
What’s a “descr” when its at home? There are some special words in pxd files like “list” which mean PyObject that happens to be a list. Is there a list of these somewhere? — John Skaller skal...@internode.on.net ___ cython-devel mailing list cython

Re: [Cython] Hello

2020-01-27 Thread John Skaller2
Ok, quick pass on Cython reference .. pretty good. Easy to read, good coverage, well written. Beginning to understand the design. Interesting thing is the limitations are the best clue. For example: "The “?” indicates that the value -1 only indicates a possible error. In this case, Cython gene

Re: [Cython] Hello

2020-01-27 Thread John Skaller2
> On 27 Jan 2020, at 20:23, Greg Ewing wrote: > > On 27/01/20 6:56 pm, John Skaller2 wrote: >> Felix binds C/C++ code with statements like: >> type PyObject = “PyObject*”; >> fun add: PyObject * PyObject -> PyObject = “Py_AddLong($1)”; >> and can use the bindings like: >> >>

Re: [Cython] Hello

2020-01-27 Thread Stefan Behnel
John Skaller2 schrieb am 27.01.20 um 06:56: > Hi! I have just built Cython but haven’t used it yet. > > I want to check I understand what it does whilst examing the sources in the > repository. > Please let me know if I have it wrong! > > Given a Python file, Cython parses it, and translates it

Re: [Cython] Hello

2020-01-27 Thread Greg Ewing
On 27/01/20 6:56 pm, John Skaller2 wrote: Felix binds C/C++ code with statements like: type PyObject = “PyObject*”; fun add: PyObject * PyObject -> PyObject = “Py_AddLong($1)”; and can use the bindings like: var a : PyObject = …. var b: PyObject = ...

[Cython] Hello

2020-01-26 Thread John Skaller2
Hi! I have just built Cython but haven’t used it yet. I want to check I understand what it does whilst examing the sources in the repository. Please let me know if I have it wrong! Given a Python file, Cython parses it, and translates it to the equivalent C, which can then be compiled to binary