Find more articles in our new Python Knowledge Base

Using CamelCase in function names

Per the PEP 8 Style Guide, function names should be lowercase, with words separated by underscores.

Anti-pattern

def someFunction():
    print("Is not the preferred PEP 8 pattern for function names")

Best practice

Using lowercase with underscores

The code below uses the PEP 8 preferred pattern of function names.

def some_function():
    print("PEP 8 Style Guide prefers this pattern")