Liste des Groupes | Revenir à cl c |
On 10.02.2025 07:41, Keith Thompson wrote:That was an issue in Python 2 where, I think, a single tab was treated as equivalent to 8 spaces for the purposes of block scoping. Depending on editor settings, that may or may not match how it visually appears. For that reason, Python 3 makes it an error to mix tabs and spaces in ways that would be misleading, i.e. if the meaning would depend on the size of a tab. Even before Python 3, the issue was generally avoided by coding conventions, e.g. using only spaces and not tabs. Not intending to go into any more detail than that, this being comp.lang.c not comp.lang.python ;)At a previous job, I reviewed an update whose apparent meaningYeah, misleading code is a pain, especially if you have got the job
differed depending on whether the editor was configured with 4- or
8-column tabstops. I don't remember the exact details, but the code
looked like either:
>
if (condition)
statement1;
statement2;
>
or:
>
if (condition)
statement1;
statement2;
>
depending on the reader's settings. Of course they're semantically
equivalent, but the first is the way the developer saw it, and the
second is misleading and is the way it looked to me.
to fix some error in these incoherent formatted modules. (I suppose
that case is yet more than only misleading if you are programming in
Python where indentation even carries semantics.)
Les messages affichés proviennent d'usenet.