Re: group several methods under a attribute

2009-04-09 Thread Aahz
In article , Rhodri James 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 way avoids polluting >your namespace so much: > >class ClsB(object): > c

Re: group several methods under a attribute

2009-04-06 Thread Rhodri James
On Mon, 06 Apr 2009 20:52:50 +0100, jelle 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 ): self.inst= other

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( 'submet

Re: group several methods under a attribute

2009-04-06 Thread Aaron Brady
On Apr 6, 12:02 pm, Aaron Brady wrote: > On Apr 6, 5:40 am, jelle 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 cla

Re: group several methods under a attribute

2009-04-06 Thread Aaron Brady
On Apr 6, 5:40 am, jelle 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, wha

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 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

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