python class design (staticmethod vs method)
问题 What's the nicer way for methods that don't need any passed information (object instance or class) because for example they just do a simple conversion. @staticmethod or method ? class Foo(object): def __init__(self, trees): self.money = Foo.trees2money(trees) @staticmethod def trees2money(trees): return trees * 1.337 class Quu(object): def __init__(self, trees): self.money = self.trees2money(trees) def trees2money(self, trees): return trees * 1.337 回答1: The choice of the type of method