[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Old Man Yells At Cloud

On Wed, Sep 20, 2017 at 4:01 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> The other reserved words are either:
> - values, like None, which can be included in expressions;
> - operators, like `is`, `or`, and `not`;
> - block statements, like `for x in seq` or `while flag` which
>   require a block;
> - statements, like `import` and `del`, which operate on names
>   rather than values.
> (Did I miss any?)
> print is the only one which could be a function, and looks like a
> function (apart from the lack of parens).

I'd add one additional variant that could be a function, and that's
'del' when used on something other than a simple name:

>>> del values[2]

Conceptually, this is very similar to values.pop(2), only it doesn't
return the value.

But for its simple-name form, where it reverses the effect of
assignment to a simple name, it has to be a statement.