Splitting up large python module impact on performance?

Chris Angelico rosuav at gmail.com
Wed Jun 13 00:24:00 EDT 2018


On Wed, Jun 13, 2018 at 2:15 PM, Rick Johnson
<rantingrickjohnson at gmail.com> wrote:
> 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.

If your names are at all sane, the mere fact that the feature doesn't
exist is proof that the name doesn't exist.

Oh wait, your code isn't anything remotely sane. But for the rest of
us, large files aren't a problem.

ChrisA



More information about the Python-list mailing list