Best place for a function?
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Wed Mar 7 18:18:04 EST 2007
More information about the Python-list mailing list
Wed Mar 7 18:18:04 EST 2007
- Previous message (by thread): Best place for a function?
- Next message (by thread): Best place for a function?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Sergio Correia a écrit : > I'm writing a class, where one of the methods is kinda complex. The > method uses a function which I know for certain will not be used > anywhere else. This function does not require anything from self, only > the args passed by the method. > > Where should I put the function? Somewhere in your module ?-) (snip) If your problem is to reduce the apparent complexity of the method, defining the function inside the method won't help that much (unless the function by itself is short enough - and event then...). Apart from having a direct access to the method's namespace, you don't gain much by doing so. And if it's a an implementation function that doesn't need to access the instance, it has no reason to be a method. Moreover, since it's not part of neither the class or the module interface, you can freely change your mind if and when you find a need to do so.
- Previous message (by thread): Best place for a function?
- Next message (by thread): Best place for a function?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list