Skip to content
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

Require enums to be named IN_ALL_CAPS #3834

Closed
socketpair opened this issue Sep 14, 2020 · 9 comments · Fixed by #3896
Closed

Require enums to be named IN_ALL_CAPS #3834

socketpair opened this issue Sep 14, 2020 · 9 comments · Fixed by #3896
Assignees
Labels
Enhancement ✨ Improvement to a component Good first issue Friendly and approachable by new contributors Help wanted 🙏 Outside help would be appreciated, good for new contributors

Comments

@socketpair
Copy link

https://bugs.python.org/issue40721

For Python code at least, Guido has proclaimed:

https://mail.python.org/pipermail/python-ideas/2016-September/042340.html

I recommend naming all enums UPPER_CASE. They're constants (within a
namespace) and that's the rule for constants. It's helpful for the
reader of the code to realize what they are when passed around -- they
have a similar status to literal constants, you know they stand for a
unique value and not for some computed quantity.
@hippo91
Copy link
Contributor

hippo91 commented Sep 14, 2020

@socketpair thanks for the suggestion.
As it is not right now in a PEP but just a recommendation, i think we need to discuss with other maintainers and users to decide whether or not we adopt this for pylint. @AWhetter @Pierre-Sassoulas @PCManticore what do you think about it?

@hippo91 hippo91 added Discussion 🤔 Enhancement ✨ Improvement to a component labels Sep 14, 2020
@Pierre-Sassoulas
Copy link
Member

Personally I write all my enums in UPPER_CASE and I think the Enums should not be changed, so its always a constant, and I think pep8 already says constants should be in uppercase. This is my interpretation though, I think we can wait for the ongoing discussion on Issue40721 to be resolved before rushing to implement something.

@AWhetter
Copy link
Contributor

I think we should check for this for the same reasons that Guido gives. I'd argue that PEP-8 does cover the them because they're constants, but I'm happy to wait for Issue40721 to come to some consensus.

@hippo91
Copy link
Contributor

hippo91 commented Sep 14, 2020

Totally agree with you. Let's wait for Issue40721 for now.

@hippo91 hippo91 added the Blocked 🚧 Blocked by a particular issue label Sep 14, 2020
@hippo91
Copy link
Contributor

hippo91 commented Sep 14, 2020

I put the label blocked just to ease the triage.

@socketpair
Copy link
Author

@hippo91 Issue40721 is closed (resolved) now.

@hippo91 hippo91 added Good first issue Friendly and approachable by new contributors Help wanted 🙏 Outside help would be appreciated, good for new contributors and removed Blocked 🚧 Blocked by a particular issue Discussion 🤔 labels Sep 15, 2020
@hippo91
Copy link
Contributor

hippo91 commented Sep 15, 2020

@socketpair thanks! I removed the blocked label.

@Hee-San
Copy link
Contributor

Hee-San commented Sep 30, 2020

Hello! I would like to try to solve this issue.

@socketpair
Copy link
Author

@Hee-San Just make a pull request ! You are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component Good first issue Friendly and approachable by new contributors Help wanted 🙏 Outside help would be appreciated, good for new contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants