[Cython] from __future__ import ...

Stefan Behnel stefan_ml at behnel.de
Fri May 16 10:30:00 CEST 2008


Hi,

Lisandro Dalcin wrote:
> I was actually thinking about string literals with pure-ascii
> characters.

I hope you're not proposing to handle them differently from other string literals.


> My intention is just if I write this in a 'pyx' file
> 
> meth = "__call__"
> if hasattr(someobj, meth):
>    do_something(...)
> 
> then this code should work as expected in Py2.X and Py3. Does this make sense?

If you want it to run on both Py2 and Py3, make that

    meth = u"__call__"

Stefan


More information about the Cython-dev mailing list