4

Recently I have started working on machine learning with Python, however I'm very new to this language. I know that "Readability counts", so I have been trying to get myself familiar with the PEP 8 coding conventions. I know where to use joined_lower, StudlyCaps and ALL_CAPS naming conventions, however I didn't quite get in which situations I can use the camelCase.

According to the PEP 8 guide:

mixedCase is allowed only in contexts where that’s already the prevailing style (e.g. threading.py), to retain backwards compatibility.

but this statement isn't saying much to me. What does it mean by "prevailing style"? What could be an applicable case that would require this backward compatibility?

I couldn't find a single example on the web that used naming style to conform to pre-existing conventions.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
tamuno
  • 103
  • 1
  • 11
  • 3
    "Prevailing style" means the one that's already in use. It's already given you an applicable example, _in the quote you've included_: [`threading.py`](https://github.com/python/cpython/blob/main/Lib/threading.py) (note these `mixedCase` names are deprecated from Python 3.10 per https://docs.python.org/3/library/threading.html). – jonrsharpe Mar 11 '22 at 22:16
  • 2
    This is probably the first question I've seen in months that is clear, useful and shows research effort so kudos to you – Sayse Mar 11 '22 at 22:23
  • @jonrsharpe I didn't know that the "threading.py" file was referring to a code in the Python documents. I couldn't find that link in the PEP8 guide, so I was wondering what that was. Now, I get it, thank you. – tamuno Mar 11 '22 at 22:25

0 Answers0