-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is verify*'s argument-name-code commented out? #63
Comments
(Sorry -- to elaborate, I know that signature comparison is somewhere between annoying, hard, and impossible :) -- so perhaps the real question is "would anyone like a patch to make such a thing enabled-by-default-but-toggleable-off", if the reasoning here was something to do with that fragility) |
@Julian It seems this code was already commented out when it was added to Zope3 more than 13 years ago, see
There must have been a CVS repository of |
@Julian Memory eludes me, as well. Perhaps @jimfulton has a notion? |
I don't remember the occasion of commenting this out, but I don't think it's a good idea to verify positional argument names, because they are positional. :) I'm guessing that this was commented out because it caused breakage. Python doesn't make a clean distinction between positional and named arguments (although Python 3 allows definition of arguments that must be provided by name). Often positional argument are obscured discourage their use by name, but this is informal. |
@jimfulton I agree that verifying positional arguments is not very useful. In any library I create (and in libraries I see from people who have enough detail generally to even care about these things), argument names I think do tend to be part of their stable public API -- i.e., one promises not to rename But I personally don't ever guarantee not to reorder arguments (mostly because I discourage passing arguments positionally pretty much ever personally). So for my own things I'd always want to verify the names of arguments in an interface, and never their position. I can definitely understand wanting to not verify either thing though, especially since I certainly don't think this particular point is paid a ton of attention by library authors, but how do you feel about making it toggleable? |
Maybe have something like |
[mypy] [9897] Rename parameters to match interface definitions This is related to these issues in zope.interface: * zopefoundation/zope.interface#63 * zopefoundation/zope.interface#140 Author: rodrigc Reviewer: adiroiban Fixes: ticket:9897
Hi!
I noticed that zope.interface.verify* are not verifying argument names.
It appears that https://github.com/zopefoundation/zope.interface/blob/master/src/zope/interface/verify.py#L108-L111 is commented out, but I can't find why in the history.
Is there a reason why that's been commented out (seemingly since 2007)?
(Sample code that unexpectedly passes:
)
The text was updated successfully, but these errors were encountered: