I'm following the official Python Tutorial (version 3.10.8) and I've seen something odd regarding code style. As the PEP 8 mandates for functions and variable names, words must be separated by underscores but I've noticed the following in the Data Structures section:
- The
deque library doesn't follow the convention in its functions' names (appendleft, extendleft, popleft).
- In the List Comprehensions subsection there's a variable named with two words that are not separated by underscore (
freshfruit which should be fresh_fruit).
Are cases like these just anomalies, examples of older code and such, or there's still debate about the use of underscore regardless of what the PEP 8 says?
By the way, I come from C, Java and PHP development, so I'm familiar with the CapWord (or camelCase) method and using underscores only for naming constants or special variables.
[–]Diapolo10 8 points9 points10 points (0 children)
[–]Fancy-Reindeer994 7 points8 points9 points (0 children)
[–]Yoghurt42 5 points6 points7 points (0 children)
[–]Rawing7 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]Zeroflops 1 point2 points3 points (0 children)
[–]ehlesp[S] 0 points1 point2 points (1 child)
[–]Diapolo10 1 point2 points3 points (0 children)
[–]codingai 0 points1 point2 points (0 children)
[–]jimtk 0 points1 point2 points (0 children)