On Thu, Apr 12, 2018 at 9:09 PM, Paul Moore <p.f.mo...@gmail.com> wrote:
> On 11 April 2018 at 22:28, Chris Angelico <ros...@gmail.com> wrote:
>> On Thu, Apr 12, 2018 at 1:22 AM, Nick Coghlan <ncogh...@gmail.com> wrote:
>>> This argument will be strengthened by making the examples used in the
>>> PEP itself more attractive, as well as proposing suitable additions to
>>> PEP 8, such as:
>>>
>>> 1. If either assignment statements or assignment expressions can be
>>> used, prefer statements
>>> 2. If using assignment expressions would lead to ambiguity about
>>> execution order, restructure to use statements instead
>>
>> Fair enough. Also adding that chained assignment expressions should
>> generally be avoided.
>
> Another one I think should be included (I'm a bit sad that it's not so
> obvious that no-one would ever even think of it, but the current
> discussion pretty much killed that hope for me).
>
> * Assignment expressions should never be used standalone - assignment
> statements should *always* be used in that case.

That's covered by the first point. If it's a standalone statement,
then the statement form could be used, ergo you should prefer the
statement form.

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to