Conventions and requirements for a python module

Michael Felt michael at felt.demon.nl
Tue Oct 11 10:29:40 EDT 2016


 From reading the python source, and other projects I am looking to 
patch I see that there is often a file __init__.py, sometimes empty 
(only comments), sometimes not.


I have tried looking in what I hope are the "regular" places such as: 
https://docs.python.org, readthedocs (it took 454 seconds to build 
something - what did it build, and where do I get it? I was assuming it 
was "latest documentation" and I even tried the old, no-longer 
maintained, wiki.

A search for __init__.py, except for on https://packaging.python.org/ 
that talks about a setup command to extract the version from __init__.py 
- I have not been able to find anything on "standards" for packages that 
are more than a single .py file.

Probably, I am not looking correctly - however, I do hope someone also 
notices that finding this is not straight forward for a novice in 
python. Had I lacked curiosity I would have given up, moved on. Instead 
- this email.

In short, I would rather try to "read the manual" and ask questions when 
I get stuck than ask "stupid" questions. That only makes me look bad ;) 
(e.g., in my other thread the idea of using subclasses was made 
frequently. That was something I was considering, but what they are, how 
they are specified, what they achieve rather than guessing that it means 
- intent some related class xxx: lines.

re: project setup: when to use _filename.py - when to use filename.py; 
what is the difference/significance of a sub-directory when "masking" 
complexity, better implementation details, is the goal (i.e., there is 
the API and there are the nitty-gritty implementation details).

The key thing I have learned is that I must not assume that python is 
anything like what I already know/knew. Assume python "does it 
differently" and mistakes maybe fewer.

Thanks for your time and pointers (to links, if not direct advice)

Michael




More information about the Python-list mailing list