[Cython] Issue with function annotations

Lisandro Dalcin dalcinl at gmail.com
Thu Sep 28 04:44:24 EDT 2017

On 27 September 2017 at 17:18, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Lisandro Dalcin schrieb am 27.09.2017 um 15:53:
>> Annotations can be used for
>> type hinting, but they are not required to do that.
> Well, they sort of are, according to PEP 484.

I gently disagree. Third paragraph of PEP 484:

Note that this PEP still explicitly does NOT prevent other uses of
annotations, nor does it require (or forbid) any particular processing
of annotations, even when they conform to this specification.

Maybe Cython should eventually ignore (maybe with a warning) if the
annotation cannot be interpreted as a type and
`annotation_typing=True` is set?

>> For example, in my
>> own use case, I'm just using it to get better docstrings.
> Then you can set the directive "annotation_typing=False".

I did in my own code (though not in the trivial example I posted,
sorry), and still got the error, so I started this thread.

> No need, I just fixed it:
> https://github.com/cython/cython/commit/4326a3b9912e27aaf9502e17d717b55b7504374a

Thanks! Now things work just fine for me.

Lisandro Dalcin
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Extreme Computing Research Center (ECRC)
King Abdullah University of Science and Technology (KAUST)

4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 0109
Thuwal 23955-6900, Kingdom of Saudi Arabia

Office Phone: +966 12 808-0459

More information about the cython-devel mailing list