Which abbreviations should we use for python variable names?

后端 未结 5 1141
说谎
说谎 2021-02-08 19:27

In generally I\'m using the standard naming stated in PEP-8 for variables. Like:

delete_projects
connect_server

However sometimes I can\'t find

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-08 19:37

    This is a problem that kind of solves itself when you're doing OOP. The subject (project, configuration) is the class and the verb (delete, etc) is the method name ie:

    class Workspace(object):
    
       def delete_project(self, project):
           log.info("Deleting", project.name)
           ...
    

提交回复
热议问题