Why NOT only one class per file?

Paddy paddy3118 at googlemail.com
Thu Apr 5 21:08:43 CEST 2007


On Apr 5, 5:51 pm, John Nagle <n... at animats.com> wrote:
> Nate Finch wrote:
> > I think you're all going about this the wrong way.  There's no reason
> > to *always* have one class per file.  However, there's also no reason
> > to have 1600 lines of code and 50 classes in one file either.
>
>     It's really an operating system thing.  We think of programs as
> living in text files, manipulated by programs which are basically text
> editors.  Python has that implicit assumption.  There have been
> systems that didn't work that way, in which the program source was
> manipulated within the language environment, in a more structured
> fashion.  Smalltalk, LISP, and (wierdly) Forth environments have been
> built that way.  But it never really caught on.
>
>     The assumption that programs are text files is deeply embedded in
> programming culture, so deeply that it's seldom questioned.  Programs
> are the last refuge of non-rich media.  You can't even embed an image
> in your program; it has to be in some completely separate file.
>
>     Interestingly, PHP breaks this model; PHP programs are web pages.
> They may be on to something.
>
>                                 John Nagle

Some languages (Specman e, and I think Perl), have the concept of
begin and end end markers. The interpreted/compiled code is what is
seen between those markers allowing the source to be embedded in
other
text.




More information about the Python-list mailing list