美文网首页
4.5. pass Statements

4.5. pass Statements

作者: 赵敏是程序媛 | 来源:发表于2019-08-28 08:42 被阅读0次

The pass statement does nothing. It can be used when a statement is required syntactically but the program requires no action. For example:

Pass语句不做任何事。只是语法要求,程序本身没有行为要求。例如:

>>>

>>> while True:

...     pass  # Busy-wait for keyboard interrupt (Ctrl+C)

...

This is commonly used for creating minimal classes:

通常使用pass语句来创建最小的类:

>>>

>>> class MyEmptyClass:

...     pass

...

Another place pass can be used is as a place-holder for a function or conditional body when you are working on new code, allowing you to keep thinking at a more abstract level. The pass is silently ignored:

Pass语句的另一处应用是,当您处理新代码时,作为函数或条件体的占位符,从而使您能够在更抽象的层次上进行思考。

>>>

>>> def initlog(*args):

...     pass   # Remember to implement this!...

相关文章

  • 4.5. pass Statements

    Thepassstatement does nothing. It can be used when a stat...

  • 英语流利说商务英语-Level6-Unit1-Part1 Fin

    Definition of financial statements. Financial statements ...

  • 2018-02-02

    Control Flow Statements The statements inside your source...

  • 4.5 Ruby

    4.5. Ruby 4.5.1. 参考链接 ruby deserialization

  • AWK chapter2

    GITHUB 2.1 模式 模式汇总BEGIN{ statements }在输入被读取之前,statements执...

  • 4.5.情海

    情海 •之音• 海天荡漾美亦仙 微风拂浪又一年 秋去冬来寒夜起 漫步庭院情丝念 并肩挽臂目温柔 怀揣暖意心依恋 南...

  • Income Statements

    为了节省时间,一些专业名称就不翻译了,有时候根本就不知道怎么译。然而全英文的写法….又不会。 财务这块有5个基本的...

  • JDBC Statements

    JDBC Statements 当获得了与数据库的连接后,就可以与数据库进行交互了。 JDBC Statement...

  • Assignment statements

    Assignment statements are used to (re)bind names to value...

  • 【必须很不一样】

    别人做过了PASS 以前干过了PASS 绝不重复PASS 不做也罢PASS 欠缺新意PASS 不够特别PASS 老...

网友评论

      本文标题:4.5. pass Statements

      本文链接:https://www.haomeiwen.com/subject/ldwuectx.html