Are there any good "python conventions and best practices" anywhere?

I am new to python, and I generally code as a means to an end, and not as a "coder." I like all the power that python contains through libraries, and I like the inherent but invisible power in python. (For example, an object-oriented, but still relatively compatible with scripter structure for creating classes, etc.)

But I continue to work in cases where I cannot find the full documentation, and I find pointers to the relevant documentation only after finding a problem that I accidentally created. So far, I have found links to the following relevant documentation:

PEP 0008
PEP 0257

However, if I missed something, none of these issues affected the "correct" python file name conventions. Having made several python scripts, I found that I should not use periods (.) In the file name, as this will cause them to be imported. After I ran into this problem, I really could find links talking about this:

periods not allowed

Nevertheless, I would really like to start actively addressing problems, instead of stepping back through appropriate mechanisms. Python has the REQUIRED aspects that make it completely unique (for example, the required spaces and the above forbidden periods in file names). I'm too new to say if this is good or something bad. But I can say that it’s a pain to keep discovering all this after the fact.

Is there some kind of "encyclopedia" that can capture all these features, in addition to the two relatively brief documents that I cited above?

Thank you all!
Mike

+6
source share
2 answers

I don’t know of any final source that covers everything, but in addition to the links that you have already posted, you should definitely check these links for some best practices:

These types of covers, as well as highlight some errors that can be avoided by using certain conventions and templates.

+5
source

I really like Code like Pythonista: Idiomatic Python , an article by David Goodger.

+3
source

Source: https://habr.com/ru/post/885760/


All Articles