File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 13081308 " \n " ,
13091309 " - also called anti-pattern because there is only one instance of the class\n " ,
13101310 " - use `__new__()` method to create a new instance of the class\n " ,
1311+ " _ `__new__()` is a class method that is called before the `__init__()` instance method\n " ,
13111312 " - use `cls` parameter to check if the instance is already created\n " ,
13121313 " - return the instance if it's already created\n " ,
1313- " - otherwise, create a new instance and return it"
1314+ " - otherwise, create a new instance and return it\n " ,
1315+ " - `__new__()` method takes the `cls` as the first argument\n " ,
1316+ " - also takes the rest of the arguments that are passed to the `__init__` method"
13141317 ]
13151318 },
13161319 {
You can’t perform that action at this time.
0 commit comments