DEV Community

Julia F.
Julia F.

Posted on • Updated on

Some advices of Python

First of all, I'm beginner in this language and my English isn't very good. So I'm sorry for the inconvenience but I started my studies and I discovered the PEP8 that can be found in their official site. This PEP8 is some rules that need to be followed and knowledge for beginners.

Indentation

Yeah, this is often common for us programmers doing this thing (if you don't do it, a flower dies...). If you have experienced this language, spaces between the lines makes difference for your code to run. So, before you do something, please give 4 spaces before to code your line.

Spaces between the classes

As I said before, spaces in python is veeery important. Above your code looks clearly, your classes need space to run. It's recommend to give two spaces between them.

Import separately

Don't save space in your code. For you import some sources for python, you need to separate them too. But, for specific imports, you can use in the same line.

Do classes and variables with lowercase

This is a challenge for me. Python doesn't recognize variables neither classes if you have an habit to uppercase the words. This is make difference while are you doing your code.

Commas is a prisoner!

Yes, in your code the commas need to be inside of the parentheses. It looks a dumb advice but we are humans and we can distract in any moment. The error of your code could be just a commas out of its prison.

This is a short post but I need to share this knowledge for the beginners as am I. These little things I feel more and more love of this language.
If its interested you, click here
Once more, I'm so sorry for my bad English and I hope that this text inspires you!

Top comments (0)