Stefan Krah added the comment:
Serhiy Storchaka <[email protected]> wrote:
> > { path: [string, bytes, int] => path_converter => path_t },
>
> And register types somewhere:
I must admit that I had a similar thought when I first heard about the project:
If we're going through all this anyway, why not have a registry with signatures
and type annotations for all functions?
But since we're dealing with C files, intuitively I think it's better to stick
to C conventions.
Imagine that the preprocessor had full-blown C parser support, so we could
declare:
static int
path_converter(/* [string, bytes, int] */ PyObject *o, void *p) {
Later we tell the preprocessor to generate a function taking an argument "path"
of type [string, bytes, int] that will be passed on to path_converter().
In the absence of type inference, it feels natural to me to declare the
type in both places.
What *is* a problem is that we need some discipline in case the type of
path_converter() changes at some point, since the C compiler won't know
about [string, bytes, int].
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue16612>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com