Splitting up large python module impact on performance?

Rick Johnson rantingrickjohnson at gmail.com
Wed Jun 13 00:15:54 EDT 2018


On Tuesday, June 12, 2018 at 10:35:47 PM UTC-5, Chris Angelico wrote:
[...]
> A few thousand lines in a file is only a problem if you're
> using an editor that lacks a Find feature. Or if you use
> bad function/class names that you can't search for.

I'm unaware of any text editor that doesn't have a find
feature. But, in a any event, the real problem is not a lack
of features, no, it's a matter of reducing the mental load.
The smaller the file, the less "off screen" data the
programmer must consider at any one time during the editing
process.

Say for instance, you want to add a new symbol, and the
symbol is going in the module namespace. Okay. Seems simple
enough, right? But if your file contains thousands of lines
of code, you can't determine with any degree of certainly
(unless you have a photographic memory!), if the name is
already assigned.

Sure, it only takes a few seconds to (1) bring up the find
feature, (2) type in the symbol, and (3) do the search. But
as programmers we are constantly inventing and assigning
names. And if your modules are so big that you have to bring
up a search tool everytime a new name needs to be assigned,
well, then, i cannot image that workflow being conducive to
any professional environment.

But knowing Chris, we can only assume that he has a custom
MUD solution. Who knows!

> > When in doubt, and when it comes to style issues, there is
> > one universal rule you should always strive to follow, and
> > that rule is to be _consistent_. PEP8 underscores the
> > importance of consistency, and you may want to read it.
> 
> Yep! It does. Let me see...
> 
> [snip link]
> 
> """However, know when to be inconsistent -- sometimes style
> guide recommendations just aren't applicable."""

Hey. Don't blame me. Blame Monty.

> > I may exaggerate on this a bit more if you're interested.
> 
> Isn't it normal for you to exaggerate everything?

Nothing about me is "normal", Chris. 

Haven't you noticed?




More information about the Python-list mailing list