On Feb 24, 2009, at 12:29 AM, Stefan Behnel wrote:
> Robert Bradshaw wrote:
>> On Feb 23, 2009, at 12:24 PM, Stefan Behnel wrote:
>>> Lisandro Dalcin wrote:
>>>> np.arange(10, dtype=s'i')
>>> There's
>>> absolutely no reason why the parameters should be byte strings.
>>
>> This is how unmarked string literals should work, right? Just like
>> the Python interpreter.
>
> Well, at least, that's what's written in the code: a byte string.
> What I'm
> saying is that /requiring/ a byte string at the interface level is
> wrong.
I agree on this point. I'm not as convinced that accepting a byte
string is wrong though.
>> I think you underestimate how long broken libraries will be out
>> there.
>
> Let's wait and see. It didn't take me very long to fix up the Py3
> unicode
> problems of lxml's API (those that were independent of Cython), so
> I would
> expect that any library can be fixed in a couple of weeks - as long
> as the
> tools play nicely. I have no idea how hard it is to fix these
> things in a
> SWIG wrapper, for example, but SWIG will also be fixed one day (and
> Cython
> code will likely not interfere with a SWIG wrapper anyway).
I don't doubt most libraries could be made Py3 unicode compliant if
someone were willing to spend "a couple of weeks" fixing it--I think
it's more a question of motivation. Unicode support is something you
care a lot about (and I'm glad you do, it's thanks to you we support
it so well in Cython) and is also a very natural and important issue
to deal with for an xml parser. People writing scientific libraries
(for example) are probably more worried about endianness issues and
fortran compatibility than unicode support, though for open source
projects hopefully someone steps up and does it.
> Anyway, the NumPy case is not a use case for a new syntax feature,
> as it
> requires plain byte strings for now, not identifiers. Lisandro, if
> you can
> come up with a compelling use case that cannot easily be fixed in user
> code, I'll rethink my opposition. For now, I cannot see how this
> feature
> can lead to anything but even more broken interfaces.
We don't need a new syntax.
def foo():
return "Something."
should return a str object: bytes under Py2, and unicode under Py3.
- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev