On 5/10/06, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > Regarding the question what to do if something un-annotated is passed, > you could have a strict and a lenient mode, sort of the equivalents of > guilty-unless-proven-innocent and innocent-unless-proven-guilty. I > guess the latter is more Pythonic, but the former is more in style > with type checking systems... :-)
I agree with this approach. > > 2. On a related note, will there be a way to add annotations to > > callables in extension modules? > > It makes sense to allow this. We already allow the C code to specify a > doc string; I think it makes sense to also specify a signature. Another benefit of this is the ability to get more info through introspection. Right now, you can't even find the number of arguments of a function implemented in C. You only know if it takes 0, 1, or variable # of arguments and if it accepts keywords. I have a patch that allows specifying the actual # of arguments, but that was for for performance and didn't provide any signature info. You could hoist the values passed to PyArgs_ParseTuple into the PyMethodDef, but there are problems with that. Some signatures can't be expressed in a single string passed to ParseTuple. Another thing is that the function definition isn't normally close to the PyMethodDef entry. That can be a maintenance problem. I don't know how to solve these problems. n _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
