1

New to coding, trying to work through conventional arrangements. I've seen various naming styles - long and short words, some use Caps for first letter and others not, most use underscore between variable name_words_like_so.

Any conventions for python variable naming I should be aware of for best practices purposes?

TIA

2 Answers 2

1

The PEP 8 Style Guide is a good start. In fact, programs such as pylint can scan a document for conformance and some projects require PEP 8 conformance for code. Lots of code is written using a Windows style (e.g., myVar) but PEP 8 (my_var) is preferred.

Sign up to request clarification or add additional context in comments.

Comments

1

I think you should check out this official Python guide on style conventions: PEP8. If you are interested in Naming Conventions in particular, they got such a section. There are several styles of naming available, some preferred more than others. One of the most common ones seems to be lower_case_with_underscores. You will encounter this one the most.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.