Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Organisation of python classes and their methods

Reply
Thread Tools

Re: Organisation of python classes and their methods

 
 
Peter Otten
Guest
Posts: n/a
 
      11-02-2012
Martin Hewitson wrote:

> Dear list,
>
> I'm relatively new to Python and have googled and googled but haven't
> found a reasonable answer to this question, so I thought I'd ask it here.
>
> I'm beginning a large Python project which contains many packages, modules
> and classes. The organisation of those is clear to me.
>
> Now, the classes can contain many methods (100s of data analysis methods)
> which operate on instances of the class they belong to. These methods can
> be long and complex. So if I put these methods all in the module file
> inside the class, the file will get insanely long. Reading on google, the
> answer is usually "refactor", but that really doesn't make sense here.
> It's just that the methods are many, and each method can be a long piece
> of code. So, is there a way to put these methods in their own files and
> have them 'included' in the class somehow? I read a little about mixins
> but all the solutions looked very hacky. Is there an official python way
> to do this? I don't like having source files with 100's of lines of code
> in, let alone 1000's.


You googled, found the right answer ("refactor"), didn't like it and are now
looking to cure the symptoms of the original problem?
Seriously, a good editor can deal with a long source file, but a class with
hundreds of methods will bring trouble to any old brain.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Organisation of python classes and their methods Paul Rubin Python 10 11-03-2012 01:38 AM
Re: Organisation of python classes and their methods Ulrich Eckhardt Python 0 11-02-2012 10:49 AM
Re: Organisation of python classes and their methods Frank Millman Python 0 11-02-2012 09:58 AM
Re: Organisation of python classes and their methods Peter Otten Python 0 11-02-2012 09:17 AM
Re: Organisation of python classes and their methods Robert Kern Python 0 11-02-2012 09:05 AM



Advertisments