Use of a variable in parent loop
MRAB
python at mrabarnett.plus.com
Sun Sep 27 23:33:09 EDT 2020
On 2020-09-28 03:53, Stephane Tougard via Python-list wrote:
> On 2020-09-27, Chris Angelico <rosuav at gmail.com> wrote:
>> Or maybe Emacs *isn't* breaking it, and it's just an autoindentation
>> thing. I don't know.
>
> From the discussion I read about this feature, it considers that 'pass' is
> use to write an empty def()
>
> def();
> pass
>
> So it's logic for it to indent one level up after a 'pass' because the people
> who made it did not see any other usage to 'pass' than that.
>
> if True:
> pass
> print("It's true")
>
> The 'pass' is totally useless by itself, it can be replaced by a comment.
>
It's used where the language requires a statement.
In, say, C, you would use empty braces:
while (process_next_item()) {
/* Do nothing. */
}
In Python that would be:
while process_next_item():
# Do nothing.
pass
More information about the Python-list
mailing list