欢迎来到 Franklin-Qi 的世界

Max
Min

python pass

在system-config-services源码包中常看到pass,而且常在
那么pass到底是什么?

一、实例

def on_systemd_manager_discovery_started(self, manager):
      pass

def run(self):
      try:
            self.mainWindow.toplevel.show()
            self.mainloop.run()
      except KeyboardInterrupt:
            pass

二、实例详解

pass在Python中作为空语句,这是为了保持程序的完整性。一般在空函数或者异常中使用。
它不做任何事,只是代表占位语句。在Python2上必须添加,而在
Python3上可写可不写。

posted on 2020-08-27 19:53  yusq77  阅读(146)  评论(0编辑  收藏  举报

导航