0

Is self required as an argument to all method definitions or just for init?

25th Jul 2016, 8:58 PM
Barcode
Barcode - avatar
2 ответов
0
All class-methods seem to require 'self' or 'cls' for decorators replacing self. Unless you replace either term with arbitrary terms. 😉 Static-methods don't seem to require either. Class-methods call the instance. Static-methods call the class.
1st Aug 2016, 1:38 AM
SouthBay
SouthBay - avatar
0
For all of them. Basically each method is part of the class, but it can only be called by an instance of the class. Dogs have four legs, but only an actual instance of the category "Dog" can actually have legs.
9th Sep 2016, 1:56 AM
Ryder Wishart
Ryder Wishart - avatar