[Cython] bint and autodoc signatures
Stefan Behnel
stefan_ml at behnel.de
Sun Apr 14 11:49:22 CEST 2013
Nikita Nemkin, 14.04.2013 11:33:
> Arguments, return values and properties of type 'bint'
> appear as 'int' in autogenerated signatures.
>
> This is very confusing for the end user and logically wrong.
> (For one thing, bint and int handle input arguments differently:
> bint accepts pretty much any Python object, while int requries
> something numeric.)
+1
> Would it be acceptable to change bint display presentation
> to 'bool' ?
>
> Note: other primitive types (short, int, float, long long etc)
> don't have this problem, because they are all numeric
> and coerce to/from Python numerics in an obvious way.
The problem I see with "bool" is that it would still be different from,
say, "list" or "MyExtType". Where the latter only accept that type and
reject anything else with a TypeError, "bool" would accept any object and
do a conversion instead. So "bool x" isn't correct either.
I'm also not sure if "bint" is a good idea as normal Python users won't
know it, so it's just as confusing as "int".
That being said, I guess I would find it less confusing to read
"def func(x : bool)"
than
"def func(bool x)"
as signature description in a docstring. So maybe that's the way to go
eventually.
Stefan
More information about the cython-devel
mailing list