Best Practices for Internal Package Structure

Sven R. Kunze srkunze at mail.de
Wed Apr 6 15:09:06 EDT 2016


On 06.04.2016 09:28, Michael Selik wrote:
> On Wed, Apr 6, 2016, 2:51 AM Steven D'Aprano <steve at pearwood.info> wrote:
>
>> On Wed, 6 Apr 2016 05:56 am, Michael Selik wrote:
>>
>> [Michael]
>>> When you made that suggestion earlier, I immediately guessed that you
>> were
>>> using PyCharm. I agree that the decision to split into multiple files or
>>> keep everything in just a few files seems to be based on your development
>>> tools. I use IPython and SublimeText, so my personal setup is more suited
>>> to one or a few files.

Interesting to know. I remember us while looking for our next IDE, we 
investigated Sublime as well. I don't remember the exact reasons anymore 
but I remember this lightweight feeling of control and doing all sorts 
of boilerplatey, distracting things extremely easily and most 
importantly extremely fast. It just feels like doing plain'ol files 
editing but with less typing; you can think more (mental activity) than 
you need to write (physical activity). That brought us to another level 
when designing stuff. Keeps us able to handle the workload.

Thus, I use it for my small PyPI projects as well. Why should I use less 
capable tools for those projects:

https://github.com/srkunze/xheap
https://github.com/srkunze/fork
https://github.com/srkunze/xcache

They are small but deserve the same professionalism I daresay.

>> How does PyCharm make the use of many files easier?
> I'll let Sven answer that one. I don't know, but I've noticed the
> correlation of habit to IDE.

Definitely true. I think that's natural and doing otherwise would impair 
the productivity improvements provided by the tools.

About the "many files easier" question: not sure what I said exactly, 
but one could also ask: "what makes the alternatives harder?"

1) learning them and using them regularly
2) you need "switching to a file" as a requirement for those other 
alternatives I mentioned in the other post

So, you before you can even start learning the alternatives, you do 1000 
times "switch to a file".


Moreover, if you split things up properly, you don't need to jump 
between 20 files at once. Usually you fix a problem/build a feature in a 
narrow slot of your code (1-4 files). If you don't do that regularly, 
it's an indication you've split your stuff up the wrong way. ;-)


Last but not least, you basically don't look for files anymore. You look 
for names, and PyCharm opens the file you need. You jump from code 
position to code position by interacting (clicking, shortcuts, etc.) 
with the code. In one file, you have only one cursor. So, when PyCharm 
jumps within in a single file, you loose your previous cursor position 
(You can jump back but that's not permanent - especially when you do 
something else in the same file). If you have two files open, you have 
two cursors and you almost always reside at the same spot there. You 
COULD do that with a single view (split view as mentioned in the last 
post) but yeah that's not as easy as just another file.


Again this is a just an attempt of explaining an observation.

Best,
Sven



More information about the Python-list mailing list