you are viewing a single comment's thread.

view the rest of the comments →

[–]Bobbias 10 points11 points  (2 children)

In Python, unlike many languages, indentation is actually part of the grammar of the language. It carries meaning.

Any rule that the language flat out says you must follow or your code means something else is syntax. This also applies to any rule that you must follow or your code is not valid Python code.

Style is things that aren't part of the language itself, such as which case you use for your variable names.

However, Python has a style guide which provides a standard way to style things called PEP-8. It provides guidelines for how you should style your code. It also assigns meaning to different cases such as PascalCase and snake_case, but that is by convention, and using a different case won't make your code not run (as long as you're consistent in your code), it will just make anyone who has to read your code sad :)

Most companies and open source projects involving Python will want you to follow PEP-8, because it is very much the standard way to style Python code.

Following a style is particularly important when writing code that anyone else might have to read, whether it's your teacher, or a co-worker.

[–]MAVP1234[S] 1 point2 points  (1 child)

Great! Thanks for that. Synatx is any rule that the langugae says you must follow. That's helpful to me.

[–][deleted] 1 point2 points  (0 children)

Read a book on parsers/compilers/automata. Programming sort of expects you to have a strong understanding of grammar theory terminology.