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

asked May 1, 2020 at 5:01

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.

answered May 1, 2020 at 5:13

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.

answered May 1, 2020 at 5:13

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.