skipping __init__ and using exploiting a class member instead

Peter Cacioppi peter.cacioppi at gmail.com
Sat Oct 19 17:44:55 EDT 2013


Is the following considered poor Python form?

class Foo (object) :
    _lazy = None
    def foo(self, x) :
        _lazy = _lazy or self.get_something(x)
    def get_something(self, x) :
        # doesn't really matter

I like this idiom for certain situations, just wondering if it will raise the hackles of other Pythonistas. 

I use this idiom sparingly, but sometimes it just fits the task at hand, I hear Guidos voice saying "use the Force" in my ear, etc.



More information about the Python-list mailing list