pass object or use self.object?
contact at xavierho.com
Tue Apr 6 17:35:01 CEST 2010
On Wed, Apr 7, 2010 at 1:19 AM, Jean-Michel Pichavant <
jeanmichel at sequans.com> wrote:
> Usually, when using classes as namespace, functions are declared as static
> (or as classmethod if required).
> class Foo:
> def process(cls, document):
> print 'process of'
> def foo(document):
> print document
> In : Foo.process('my document')
> process of
> my document
> There is no more question about self, 'cause there is no more self. You
> don't need to create any instance of Foo neither.
JM, I beg to differ. If many functions are static inside a class, I would
simply put those methods right under a module instead.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list