具体见The Python Language Reference 与Attribute相关的有 __get__ __set__ __getattribute__ __getattr__ __setattr__ __getitem__ __setitem__ Reference描述如下 3.3.2. Customizing attribute access The following methods can be defined to customize the meaning of attrib…
1.名称修改机制 大概是会对形如 __parm 的成员修改为 _classname__spam 9.6. Private Variables “Private” instance variables that cannot be accessed except from inside an object don’t exist in Python. However, there is a convention that is followed by most Python code: a nam…
lst =[11,22,44,2,1,5,7,8,3] for i in range(len(lst)): i = 0 while i < len(lst)-1: if lst[i] > lst[i+1]: #前面比后面大 lst[i],lst[i+1] = lst[i+1],lst[i] i = i +1 print(lst)…