On Thu, Jan 6, 2011 at 8:00 PM, Erwin Mueller <erwin.muel...@deventm.org> wrote: > On Thursday 06 January 2011 21:23:57 Robert Kern wrote: > > On 1/6/11 12:43 PM, Erwin Mueller wrote: > > > On Thursday 06 January 2011 16:28:49 dmitrey wrote: > > >> hi all, > > >> I have th PEP (I'm not sure something like that hadn't been proposed > > >> although): > > >> very often in a Python file header the following lines are present, > > >> like: > > >> from MyModule1 import myFunc1 > > >> import MyModule2 as mm2 > > >> from MyModule3 import myFunc3 as mf3 > > >> etc > > >> > > >> and after several pages of code they are using somewhere, maybe only > > >> one time, e.g. > > >> r1 = myFunc1(...) > > >> r2 = mm2.myFunc2(...) > > >> r3 = mf3(...) > > >> It makes programs less clear, you have to scroll several pages of code > > >> in IDE to understand what it refers to. > > >> > > >> Regards, D. > > > > > > Why you have several pages of code in the first place? Don't you know > > > that you can split your code in files? Just a suggestion. > > > > Modules *should* have several pages of code. *Functions* should be limited > > to about a page of code at maximum. > > I'm not quite familar with Python development, but why should modules > be so big that the user is lost in the code?
They shouldn't, but due to Python's conciseness, the amount of code a module can hold before it becomes unwieldy is a good bit greater than some more verbose languages. Unlike say, Java, it is quite normal to have several classes, functions, and constants in a single Python module. "Several pages" is not an unreasonable upper bound for a Python module. > What is preventing you from > splittin a module in several files, each file with a single responsibility? Circular dependencies perhaps. Also, how a responsibility is defined and what level of module granularity is most useful is a design decision requiring skilled judgment; it's possible that just-one-module is appropriate for Dmitrey's situation. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list