1def public_api():
2 print ("public api")
3
4def _private_api():
5 print ("private api")
6
1>>> def function(class):
2 File "<stdin>", line 1
3 def function(class):
4 ^
5SyntaxError: invalid syntax
6>>> def function(class_):
7... pass
8...
9>>>
10
1class Prefix:
2... def __init__(self):
3... self.public = 10
4... self._private = 12
5>>> test = Prefix()
6>>> test.public
710
8>>> test._private
912
10
1# Ignore a value of specific location/index
2for _ in range(10)
3 print ("Test")
4
5# Ignore a value when unpacking
6a,b,_,_ = my_method(var1)
7
1>>> class MyClass():
2... def __init__(self):
3... print ("OWK")
4
5>>> def my_defination(var1 = 1, class_ = MyClass):
6... print (var1)
7... print (class_)
8
9>>> my_defination()
101
11__main__.MyClass
12>>>
13