Should I use "camel case" or underscores in Python?

Question:

So which is better and why?

def my_function():

or

def myFunction():
Asked By: tdc

||

Answers:

PEP 8 advises the first form for readability. You can find it here.

Function names should be lowercase, with words separated by
underscores as necessary to improve readability.

Answered By: David M

for everything related to Python’s style guide: i’d recommend you read PEP8.

To answer your question:

Function names should be lowercase, with words separated by
underscores as necessary to improve readability.

Answered By: aayoubi

Function names should be lowercase, with words separated by
underscores as necessary to improve readability. mixedCase is allowed
only in contexts where that’s already the prevailing style

Check out its already been answered, click here

Answered By: Harish Kurup
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.