Please enable / Bitte aktiviere JavaScript!
Veuillez activer / Por favor activa el Javascript![ ? ]
Record in Python else: return root in one line is not welcome? - Q&A

Record in Python else: return root in one line is not welcome?

0 like 0 dislike
Good afternoon.
Is this the recording in one line is considered custom, rare,
prevents the perception of information in General?

This entry I noticed Peter Norvega when I listened to his online course Design of computer programs.
asked by | 35 views

2 Answers

0 like 0 dislike
Yes, not welcome.
PEP8, subsection “Other recomendations”:
Compound statements (multiple statements on the same line) are generally discouraged.

However, later in PEP8 there is a comment:
While sometimes it's okay to put an if/for/while with a small body on the same line, ...

But in practice, any reviewer will reject the record. For a colon inside a complex expression must follow a new line, so you can easily distinguish it from the colon in a type annotation or, say, a dict comprehension. So what else: return − it is rather a no-no than sometimes ok.
answered by
0 like 0 dislike

what is the Python root ?
answered by
Welcome to Bug-code Q&A, where you can ask questions and receive answers from other members of the community.

24.8k questions

46.2k answers


12.3k users

24,788 questions
46,220 answers
12,337 users