Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set the default subtitles language in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Python Naming Conventions

Give Feedback

Learn about Python naming conventions. In this lesson, you’ll see how to choose sensible names for Python objects such as variables, functions, modules and so on. You’ll also see what naming styles are compliant with PEP 8 and which one’s aren’t.

David Y D on March 20, 2020

This was very clear, thank you! I have 1 question. You said classes should be named FirstLetterOfEachWordCapital, but what do you name a class being passed into a function (def somthing(MyClass): or def somthing(my_class):)?

Dan Bader RP Team on March 21, 2020

For function and method arguments PEP 8 recommends using lowercase words connected by single underscores. For example:

class MyClass:

def something(my_class):
    # my_class is an instance of MyClass

Become a Member to join the conversation.