-
Notifications
You must be signed in to change notification settings - Fork 219
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
N812 for uppercase shorthand #52
Comments
I've been working on Python for several years and, anecdotally speaking, can't remember seeing this ever, let alone it being common practice. If there's more evidence of this outside of selenium's docs/users, I'm happy to consider this change. Otherwise, I'm not sure the effort would be entirely justifiable. |
To be fair, I don't think it's a good practice. But its origin is not Selenium docs. |
@peterdemin I'm sorry, I didn't do a great job explaining what I was asking for. In general, I'm happier to have false negatives than false positives but I'm happiest to have neither. For this specific error code, the guidance isn't exactly clear in the PEP. This is a grey area. For items like this, I would like to try to standardize on what the larger python community is already doing, as that would mean we're causing less pain. Selenium and BeautifulSoup both have wonderfully large user-bases. I'm sure to some extent they overlap as well. I'd love to see if this idiom is common outside of these communities and in the larger python community, and one way to do that is to leave this issue open for a while and continue to collect feedback from other folks. You don't have to do other work in tracking this information down. My inkling (again, it's just a feeling) is that people may be more surprised that the examples you gave don't raise the error rather than that they do raise the error. But this is why I'd like to see who else sees this issue and comments on it. I'm frankly happy to add this if it proves out that this is something common that I've failed to see in my years. As a note to other folks who may stumble across this thread:
|
Having stumbled upon this thread, think I can offer my 2c: I would be surprised if this tool did not detect this as an error. While it's most certainly a grey area in PEP 8, it results in having something that would normally be cased in lower as an uppercase constant... not something I would typically expect. For projects which rely on that naming convention (e.g., if using example from Selenium docs), why not these projects just add to ignore list? On a related side note, this should be OK::
|
As another data point, the standard Python docs suggest importing (I checked the BeautifulSoup docs, and importing that as It seems like a good compromise to me to support importing CamelCaseNames as strict abbreviations (e.g., importing But it's also easy to stick a |
(In response to @sigmavirus24 at #99 (comment)) My lines of thinking: We currently allow uppercase class names (related test), in that context, importing a ClassName as an abbreviated UPPERCASE form also sounds somewhat reasonable. (0.25+) I have personally both seen and used imports like According to PEP8 CapWords is used for:
I expect pep8-naming to also normally not allow importing CapWords as uppercase. (-0.25)
(+0.25?) TLDR; Overall, I'm not very sure and could go either way, but my current preference is for having a separate error code for |
I like that a lot and am +1 on that actually. |
I took a crack at implementing this approach in #133. |
Thanks, @jparise! |
What about |
I believe it's common practice to shorten long imports from selenium like it is done in Selenium docs: http://selenium-python.readthedocs.io/waits.html
But pep8-naming detects error:
I think the intention of N812 was to avoid importing lowercase as CamelCase, but this one is actually UPPERCASE, so I think it's false positive.
The text was updated successfully, but these errors were encountered: