Re: group several methods under a attribute

2009-04-09 Thread Aahz
In article mailman.3435.1239058603.11746.python-l...@python.org, Rhodri James rho...@wildebst.demon.co.uk wrote: You'll note that this is, all Aaron's protests to the contrary, splitting your class up into multiple cooperating classes. Ayup. If you're set on doing it like this, doing it this

group several methods under a attribute

2009-04-06 Thread jelle
Hi, I'm working on a pretty large class and I'd like to group several methods under a attribute. Its not convenient to chop up the class in several smaller classes, nor would mixins really solve the issue. So, what is a pythonic way of grouping several methods under a attribute? Many thanks

Re: group several methods under a attribute

2009-04-06 Thread Gerhard Häring
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

Re: group several methods under a attribute

2009-04-06 Thread jelle
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). Thanks Gerard, I'll take your advice. -jelle -- http://mail.python.org/mailman/listinfo/python-list

Re: group several methods under a attribute

2009-04-06 Thread Aaron Brady
On Apr 6, 5:40 am, jelle jelleferi...@gmail.com wrote: Hi, I'm working on a pretty large class and I'd like to group several methods under a attribute. Its not convenient to chop up the class in several smaller classes, nor would mixins really solve the issue. So, what is a pythonic way

Re: group several methods under a attribute

2009-04-06 Thread Aaron Brady
On Apr 6, 12:02 pm, Aaron Brady castiro...@gmail.com wrote: On Apr 6, 5:40 am, jelle jelleferi...@gmail.com wrote: Hi, I'm working on a pretty large class and I'd like to group several methods under a attribute. Its not convenient to chop up the class in several smaller classes, nor

Re: group several methods under a attribute

2009-04-06 Thread jelle
Hi Aaron, Thanks a lot for your suggestions. I wasnt familiar with the __get__ magic, which seems interesting. So, finally it seems that the cleanest pattern is: class ClsA( object ): def __init__( self, other ): self.inst= other def submethA( self, arg ): print(

Re: group several methods under a attribute

2009-04-06 Thread Rhodri James
On Mon, 06 Apr 2009 20:52:50 +0100, jelle jelleferi...@gmail.com wrote: Hi Aaron, Thanks a lot for your suggestions. I wasnt familiar with the __get__ magic, which seems interesting. So, finally it seems that the cleanest pattern is: class ClsA( object ): def __init__( self, other ):