#module names should be all lowercase
import mymodule
#normal variables are lowercase_with_underscores
my_variable = 'value'
#constants are UPPERCASE
CONSTANT = 'never changes'
#classes are UpperCaseCamelCase
class MyClass(self):
pass
################################################################################
#IN COMMENTS
################################################################################
# module/file names should be in lowercase (ALL LETTERS)
# example: import mymodule OR import myfile
# ------------------------------------------------------------------------------
# variable/parameter names should use snake case
# (means separate words by '_' (underscore))
# example: this_is_a_variable: int = 5 (: int, represents data type)
# example 2: this_is_a_parameter: str = 'A String'
# ------------------------------------------------------------------------------
# functions: same as variables and parameters
# ------------------------------------------------------------------------------
# classes, uses CamelCase, First letter of each word should be Capital
# example:
# class AClassOk:
# def __init__(self):
# pass
# ------------------------------------------------------------------------------
# Constants: ALL LETTERS SHOULD BE CAPITAL, WORDS SEPERATED BY '_'(UNDERSCORE).
# CONST = "OOF"
###############################################################################
# IN REAL LIFE
###############################################################################
import amodule
a_var: float = 3.1
def eat_burger(a_parameter):
print(a_parameter)
class EatCocaCola:
def __init__(self):
pass
A_CONST: bool = False
Packages: short, all-lowercase names. Preferably no underscores.=>utilities
Modules: short, all-lowercase names. Can have underscores. => db_utils
Classes: CapWords (upper camel case) convention => BankAccount
Functions: lowercase, words separated by underscores => open_account
(snake_case)
Variables: lowercase, words separated by underscores => account_id
(snake_case)
Constants: all-uppercase, words separated by underscores => MIN_APR