++ on using @staticmethod. Makes it more explicit and descriptive anyway...
On Tue, Aug 10, 2010 at 9:14 PM, Vishvananda Ishaya <[email protected]> wrote: > The magic in rpc.py needs certain methods to be in the services to be > methods on the object, even though they may not use self. For an example, > see lease_ip in network/service.py. I disabled the warning in my cleanup, > but if i can convert these to static methods, perhaps that is better. I > assume this won't break the rpc.py magic, but we should probably test it. > Vish > > On Tue, Aug 10, 2010 at 4:37 PM, Chris Behrens <[email protected]> > wrote: >> >> Ah, yeah, that's a good suggestion. >> >> >> On Aug 10, 2010, at 4:31 PM, Monty Taylor wrote: >> >> > On 08/10/2010 04:26 PM, Chris Behrens wrote: >> >> >> >> All, >> >> >> >> What's the preference on methods that could be functions? pylint is >> >> currently complaining on any class method that doesn't access 'self', >> >> meaning that the method doesn't necessarily need to be a part of a >> >> class. I'm going back and forth on it. I tend to think it makes >> >> sense to keep some things as a part of a class for organizational >> >> purposes... but I don't know. >> > >> > I like inclusion for org purposes... but: >> > >> >> Some examples are in nova/compute/model.py's InstanceDirectory. Most >> >> of the methods don't need to be a part of the class, but I can see >> >> where it's nice to organize it all that way... If we want to keep >> >> it, I think we may want to make pylint ignore this code? >> > >> > Or perhaps just remove the self arg and make it a static method: >> > >> > class Foo: >> > >> > �...@staticmethod >> > def bar(a, b): >> > # isn't really part of the class, but is organizationally. >> > >> > >> > Monty >> >> >> _______________________________________________ >> Mailing list: https://launchpad.net/~nova >> Post to : [email protected] >> Unsubscribe : https://launchpad.net/~nova >> More help : https://help.launchpad.net/ListHelp > > > _______________________________________________ > Mailing list: https://launchpad.net/~nova > Post to : [email protected] > Unsubscribe : https://launchpad.net/~nova > More help : https://help.launchpad.net/ListHelp > > _______________________________________________ Mailing list: https://launchpad.net/~nova Post to : [email protected] Unsubscribe : https://launchpad.net/~nova More help : https://help.launchpad.net/ListHelp

