### a_test.py
# filename is using snakecase
# class must be this kind
class Test:
# functions must have self in a class
def hello(self):
print("hello world")
# a variable and outclas function must be lowercase at first, use snakecase is ok as well
a: int= 1
def outClassFunction():
print(a)
outClassFunction()
# a doc must write in """ this says the desc of class func or outclass func or a variable"""
# 匿名函数越过def,closure取得匿名函数的地址,也就是实际函数名
closure = lambda x,y: x + y
# 调用时必须补全参数
print(closure(1,2))
python代码风格和lambda函数初尝
最新推荐文章于 2024-07-23 16:23:28 发布