[Python-Dev] Examples for PEP 572

Chris Angelico rosuav at gmail.com
Wed Jul 4 03:02:07 EDT 2018


On Wed, Jul 4, 2018 at 4:07 PM, Serhiy Storchaka <storchaka at gmail.com> wrote:
> 04.07.18 00:51, Chris Angelico пише:
>>
>> On Wed, Jul 4, 2018 at 7:37 AM, Serhiy Storchaka <storchaka at gmail.com>
>> wrote:
>>>
>>> I believe most Python users are not
>>> professional programmers -- they are sysadmins, scientists, hobbyists and
>>> kids --
>>
>>
>> [citation needed]
>
>
> I don't understand what citation do you need.

Anything at all that suggests that "most Python users are not
professional programmers". Anything beyond just a hunch of yours.

>>> In particularly mutating and
>>> non-mutating operations are separated. The assignment expression breaks
>>> this.
>>
>>
>> [citation needed]
>
>
> In Python the assignment (including the augmented assignment) is a
> statement, del is a statement, function and class declarations are
> statements, import is a statement. Mutating methods like list.sort() and
> dict.update() return None to discourage using them in expressions. This a
> common knowledge, I don't know who's citation you need.

"Assignment is a statement" -- that's exactly the point under discussion.

"del is a statement" -- yes, granted

"function and class declarations are statements" -- class, yes, but
you have "def" and "lambda" as statement and expression equivalents.

"import is a statement" -- but importlib.import_module exists for a reason

So you have two statements (del and class), one statement with a
function form (import), and one statement with an expression form
(def/lambda).

I'm going to assume that your term "mutating" there was simply a
miswording, and that you're actually talking about *name binding*,
which hitherto occurs only in statements. Yes, this is true. And it's
the exact point under discussion - that restricting name bindings to
statements is unnecessary.

ChrisA


More information about the Python-Dev mailing list