On Wed, 26 Nov 2008 13:24:25 -0800, Jason Scheirer wrote:

> On Nov 26, 11:40 am, Terry Reedy <[EMAIL PROTECTED]> wrote:

>> def Skipper(object):
>>      def Skip(): pass
>> skipper = Skipper()
>>
>> def _On_Menu_File_Open ( self, event = skipper ):
>>     event.Skip ()
>>
>> etc.
> 
> I think this methods works best, but quite frankly, if a method is only
> two lines long, then you've likely got a code smell and no amount of
> over-design is going to cover for it.

That's nuts. Methods should be as short as they need to be. Except in 
code where performance is *REALLY* a bottleneck, you should be factoring 
out common code into methods, even if the common code is only one or two 
lines. Sometimes the entire class is just two lines:

class MyModuleError(ValueError):
    pass


It's unusual for something to be that short, simply because you can't do 
much in just two lines (especially if you are counting the method 
definition as one of those lines) but something isn't wrong just because 
it's short.


-- 
Steven
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to