[Python-ideas] Python-ideas Digest, Vol 131, Issue 106
Koos Zevenhoven
k7hoven at gmail.com
Tue Oct 31 06:17:02 EDT 2017
On Tue, Oct 31, 2017 at 11:24 AM, Petr Viktorin <encukou at gmail.com> wrote:
> On 10/31/2017 09:54 AM, Koos Zevenhoven wrote:
>>
>>
>> I wonder if that's more easily understood if you write it along these
>> line(s):
>>
>> (the_bob,) = (name for name in ('bob','fred') if name=='bob')
>>
>
> There are (unfortunately) several ways to do it. I prefer one that avoids
> a trailing comma:
>
> [the_bob] = (name for name in ('bob','fred') if name=='bob')
>
>
Maybe it's just me, but somehow that list-like syntax as an assignment
target feels wrong in somewhat the same way that (1, 2).append(3) does.
––Koos
PS. In your previous email, something (your email client?) removed the
vertical line from the quoted Chris's email, so it looks like just an
indented block. I wonder if a setting could fix that.
--
+ Koos Zevenhoven + http://twitter.com/k7hoven +
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20171031/8ca591a5/attachment-0001.html>
More information about the Python-ideas
mailing list