group several methods under a attribute

Gerhard Häring gh at ghaering.de
Mon Apr 6 08:44:28 EDT 2009


jelle wrote:
> Hi,
> 
> I'm working on a pretty large class 

Can you describe what its purpose is?

> and I'd like to group several methods under a attribute.

That doesn't work in Python without bending the Python.

> Its not convenient to chop up the class in several smaller classes,

But that's almost certainly the right thing to do.

> nor would mixins really solve the issue.
> So, what is a pythonic way of grouping several methods under a
> attribute?

Whatever it is, you should find a better way instead of cramming
everything into a single class. That smells of the God Object
antipattern (http://en.wikipedia.org/wiki/God_object).

-- Gerhard




More information about the Python-list mailing list