python naming conventions

Solutions on MaxInterview for python naming conventions by the best coders in the world

showing results for - "python naming conventions"
Lisa
28 Jan 2018
1#module names are lowercase
2import mymodule
3
4#variable names, function names, and parameter names are snake case
5my_variable = 27
6def my_function(my_parameter):
7	print(my_parameter)
8    
9#constants are uppercase
10MY_CONSTANT = 27
11
12#classes are pascalcase
13class MyClass:
14	pass
Kimberley
11 Jan 2019
1################################################################################
2#IN COMMENTS
3################################################################################
4
5# module/file names should be in lowercase (ALL LETTERS)
6# example: import mymodule OR import myfile
7
8# ------------------------------------------------------------------------------
9
10# variable/parameter names should use snake case
11
12# (means separate words by '_' (underscore))
13# example: this_is_a_variable: int = 5 (: int, represents data type)
14# example 2: this_is_a_parameter: str = 'A String'
15
16# ------------------------------------------------------------------------------
17
18# functions: same as variables and parameters
19
20# ------------------------------------------------------------------------------
21
22# classes, uses CamelCase, First letter of each word should be Capital
23# example:
24# class AClassOk:
25#	def __init__(self):
26#		pass
27
28# ------------------------------------------------------------------------------
29
30# Constants: ALL LETTERS SHOULD BE CAPITAL, WORDS SEPERATED BY '_'(UNDERSCORE).
31# CONST = "OOF"
32
33###############################################################################
34# IN REAL LIFE
35###############################################################################
36
37import amodule
38
39a_var: float = 3.1
40
41def eat_burger(a_parameter):
42  print(a_parameter)
43  
44class EatCocaCola:
45  def __init__(self):
46    pass
47
48A_CONST: bool = False
49  
queries leading to this page
function naming convention in pythonpython 3 naming conventionpython naming conventions upython naming conventions spython function naming conventionnaming convention for python functionspython naming conventions npython naming conventions filenaming convention for python methodspython naming conventions for variablesnaming convention in python classpythonic naming conventionspython naming conventions wpython class naming conventionpython naming conventions ipython naming convention nedirpy naming conventionspython naming conventions pnaming conventions in creating a variable in pythonpython variable naming conventionsvariable naming conventions in pythonmethod naming convention in pythonpython naming conventions bnaming convention for python classespython default naming conventionmethod name convention in pythonvariables in python naming conventionspython variable naming conventionnaming conventions in pythonpython variable naming conventions with typepython naming conventions mpython naming conventions examplespython naming conventions onaming convention pythonpython module naming conventionpython variable naming conventions rulesconvention for naming python variablespython class function naming conventionnaming convention in pythonpython naming convention for functionspython naming case conventionspython style conventionspython methods naming conventionpython naming conventions jclass and methods in python naming conventionsnaming convention of functions in pythonpython name conventionsvariable naming convention in python3python naming convention for class attributesnaming convention in python functionspython conventions function namesnaming convention for functions in pythonnaming convention in pythonhpy naming conventions onaming pythonfunction naming convention pythonnaming conventions that can be used in pythonpython method name conventionvariable naming conventions pythonpython naming conventionspy 3d naming conventionspython naming conventions cpython naming conventions aname convention python examplewhat is the naming convention used in python for variablespy naming conventions apython naming convention for defpython naming conventionmodule naming convention pythonname conventions pythonpython naming conventions tpython object naming conventionpython standard naming conventionsvariable naming convention pythonpython function naming conventionspython naming conventions evariable naming convention in pythonpython method naming conventionnaming conventions pythonpython def naming conventionpython conventions python naming conventions