[Cython] Prototype for parametrized types
Stefan Behnel
stefan_ml at behnel.de
Tue Mar 11 09:08:32 CET 2008
Hi,
Dag Sverre Seljebotn wrote:
> Declaring types on arguments are then simply a short-hand for "always run
> argument through the given factory/type constructor", and can be
> implemented for Python types as well, so
>
> def foo(a : unicode):
>
> would make sure int and str params are converted to unicode.
No way. Converting a byte string to unicode is something that has to be done
explicitly. How could you know the input encoding that is used for the byte
sequence?
And while automatic conversion of numbers to strings is less problematic, I
would not expect my language to do that for me (except for printing, maybe).
Stefan
More information about the Cython-dev
mailing list