Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__new__和__init__的区别 #68

Open
lanzhiwang opened this issue Jan 3, 2019 · 1 comment
Open

__new__和__init__的区别 #68

lanzhiwang opened this issue Jan 3, 2019 · 1 comment

Comments

@lanzhiwang
Copy link

lanzhiwang commented Jan 3, 2019

__new__() 是一个类方法,不是静态方法

@matrixback
Copy link

matrixback commented Jan 16, 2019

new() 是一个类方法,不是静态方法

是静态方法,只不过是特殊的静态方法,不用显式声明。

Called to create a new instance of class cls. __new__() is a static method (special-cased so you need not declare it as such) that takes the class of which an instance was requested as its first argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants