Closed jaraco closed 7 years ago
You are correct! That function is supposed to accept any callable as a type, since that's what argparse
accepts, but the annotation checker is too strict. I'll post a fix shortly.
Fast work and already working in my code too. Thanks much!
The docs say
Any type (or in fact any callable) that returns an object when given a string argument can be used, though there are a few special cases that are described later.
which conflicts with what the docs also say:If an invalid annotation is given (that is, it isn’t a type, str, (type, str), or (str, type), an AnnotationError is raised
.The latter seems to be true to the implementation:
I'd much prefer if any callable could be accepted. In particular, I'd like to do this:
Is there a reason the annotation can't be any callable?