Liste des Groupes | Revenir à cl misc |
On Thu, 22 Aug 2024 10:10:18 +0200, David Brown wrote:No, it does not. Python treats tabs (at the start of lines, which is the only relevant point here) as 8 spaces by default. You can change that with command-line flags if you want. But it is quite happy with mixtures of tabs and spaces as long as the result after tab-to-space conversion is consistent with Python syntax.
I am a big fan of clear and consistent layout and indentation, which isPython prohibits those space/tab inconsistencies.
forced on you by Python (and Occam), but I too prefer explicit blocking.
It's harder to get things wrong with explicit blocking, and you are
never faced with space vs. tab conflicts causing semantic changes to the
code.
Nevertheless, I don’t like the loss of redundancy in the way codeI would not recommend that. But I think it makes sense to add a "return" at the end of functions if they otherwise end in indentations, to give a clear ending to the function definition. That is vastly better than an "# end" comment because it is checked for Python syntax and correct (or at least plausible) indentation. If you need an end marker for other blocks, "pass" is your friend - again it is better than a comment.
structure is expressed, which is why I like to put in “#end” comments.
Les messages affichés proviennent d'usenet.