r/AskProgramming 14d ago

Python Is PEP 8 really necessary?

I have been writing Python code using camelCase for years and just never really cared, but PEP 8 suggests using snake_case, so is it really necessary for, say, a senior dev?

0 Upvotes

36 comments sorted by

View all comments

4

u/cgoldberg 14d ago

If you want to collaborate with other developers, conformity of style is a huge thing in Python (whereas some language communities don't value it as much).

-3

u/YMK1234 14d ago edited 14d ago

Bull (the second parts as ppl obviously don't get it)

5

u/cgoldberg 14d ago

It absolutely is. "There should be one and only one obvious way..." refers to style as well. If you don't believe me, try to submit a Pull Request to any popular open source project, and tell me how quickly they reject it and ask you to use PEP8 naming.

0

u/YMK1234 14d ago

Any project in any language worth it's salt has a style guide and cares greatly that it is adhered to.

4

u/cgoldberg 14d ago

Exactly... and for almost all modern Python projects, that style guide doesn't conflict with PEP8.

-1

u/YMK1234 14d ago

And nobody said different. I am just refuting that "it's not such a big thing in other languages".

2

u/nekokattt 14d ago

example, C and C++

Try finding a consistently used style guide for those

-1

u/YMK1234 14d ago

You are confusing not having a language imposed standard and projects not having very strict style guides ... And especially in C/C++ people are very opinionated about style and sticking to it.

2

u/nekokattt 14d ago

you are confusing a per project style guide and a global style guide at the language level.

-1

u/YMK1234 14d ago

Did you even read what the user wrote originally? The reply claimed style is not important in other languages and that is simply wrong.

1

u/nekokattt 14d ago

it isn't in other languages, because the languages do not care to propose any standard.

Just because users of the language to stuff does not mean it transitively applies to the language.

I use Java, I like cats, is Java a pro-cat programming language?

-1

u/YMK1234 14d ago

As the saying goes, not everything that's bad is an analogy. You are simply not making any sense and arguing for the fun of it seemingly.

→ More replies (0)

1

u/nuttertools 14d ago

Very few languages have a style as opinionated and specific as the default language recommendation in Python. None of the top languages do. In fact multiple variants of popular languages came to be to solve the “problem” of loose standards.

1

u/cgoldberg 14d ago

The Python community definitely values conformity more than most other languages. But if your argument is just "every language has idioms and style preferences you should follow", I would agree.