【问题标题】:In python constructor runs on compile time or run time?在 python 构造函数中运行在编译时还是运行时?
【发布时间】:2019-01-19 07:06:45
【问题描述】:

python 构造函数在它实例化时初始化。我想知道实例化的运行时间和构造函数的运行时间。

【问题讨论】:

    标签: python-3.x compile-time


    【解决方案1】:

    python 中的构造函数用于初始化对象。对象是在运行时创建的,因此构造函数在运行时运行。 python在编译时不执行任何代码。

    【讨论】:

    • 所以类和对象的实例化一样
    猜你喜欢
    • 1970-01-01
    • 2012-06-26
    • 2013-08-29
    • 2013-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-28
    • 2011-04-07
    相关资源
    最近更新 更多