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

Class attributes naming rules #78

Closed
sobolevn opened this issue Oct 2, 2018 · 7 comments
Closed

Class attributes naming rules #78

sobolevn opened this issue Oct 2, 2018 · 7 comments

Comments

@sobolevn
Copy link
Member

sobolevn commented Oct 2, 2018

I have occasionally found out that it is possible to use any case for naming class attributes:

class Test(object):
    camelCase = 1
    snake_case = 2
    UPPER_CASE = 3

flake8 and pep8-naming won't complain about it.

Since https://www.python.org/dev/peps/pep-0008 does not say a word about class attributes naming style, I believe that it might be a hot discussion.

In my opinion class attributes should be using snake_case by default.
What do you think? Thanks!

@lordmauve
Copy link
Contributor

I would read UPPER_CASE as indicating a class-level constant. For example, enum.Enum would typically be defined with upper-case names.

I'd like to see warnings about camelCase class attributes, however.

@sigmavirus24
Copy link
Member

I agree with @lordmauve that UPPER_CASE should not be forbidden. camelCase does make sense to warn about though. I'd review a PR that implements that change.

@5j9
Copy link
Contributor

5j9 commented Oct 3, 2018

I can't test right now, but I believe I implemented this nearly 4 months ago. (1679354)

@sobolevn
Copy link
Member Author

sobolevn commented Oct 3, 2018

It is not published yet, I guess.

@sigmavirus24
Copy link
Member

Excellent. Let's prepare a release then @5j9

@5j9
Copy link
Contributor

5j9 commented Oct 6, 2018

@sigmavirus24, is there anything I can do in preparation for a new release?

@sigmavirus24
Copy link
Member

I think this was released in 0.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants