Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6f1b92c

Browse files
authored
增添单例模式
1 parent81c88e0 commit6f1b92c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ ps: `__metaclass__`是创建类时起作用.所以我们可以分别使用`__met
521521
>​单例模式是一种常用的软件设计模式。在它的核心结构中只包含一个被称为单例类的特殊类。通过单例模式可以保证系统中一个类只有一个实例而且该实例易于外界访问,从而方便对实例个数的控制并节约系统资源。如果希望在系统中某个类的对象只能存在一个,单例模式是最好的解决方案。
522522
>
523523
>`__new__()``__init__()`之前被调用,用于生成实例对象。利用这个方法和类的属性的特点可以实现设计模式的单例模式。单例模式是指创建唯一对象,单例模式设计的类只能实例
524-
524+
[伯乐在线详细解释](http://python.jobbole.com/87294/)
525525
**这个绝对常考啊.绝对要记住1~2个方法,当时面试官是让手写的.**
526526

527527
###1 使用`__new__`方法

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp