(Python) Coding style parentheses in ifs, loops, etc -


just personal preference, prefer?

if filename in filesandfolderslist:     while != "test":         = input("input: ") 

or

if(filename in filesandfolderslist):     while(a != "test"):         = input("input: ") 

either 1 works, personal preference think. second 1 more similar java/c++. prefer , why?

you should never use parentheses after statements, in second style. confusing reader making functions. doing group expression in parentheses, python ignore these , have achieved removal of space after keyword.

you can't use style compound statements. cannot use style for loop or with statement includes as <target> clause.

the python style guide makes no mention of second (parenthesized) style, @ all; makes assumption no-one use it.


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -