On 05.07.2018 3:36, Chris Angelico wrote: > On Thu, Jul 5, 2018 at 10:33 AM, Victor Stinner <vstinner at redhat.com> wrote: >> 2018-07-05 2:15 GMT+02:00 Chris Angelico <rosuav at gmail.com>: >>> On Thu, Jul 5, 2018 at 10:03 AM, Victor Stinner <vstinner at redhat.com> wrote: >>>> On the 3360 for loops of the stdlib (*), I only found 2 loops which >>>> would benefit of assignment expressions. >>>> >>>> It's not easy to find loops which: >>>> - build a list, >>>> - are simple enough to be expressed as list comprehension, >>>> - use a condition (if), >>>> - use an expression different than just a variable name as the list >>>> value (value appended to the list). >>> Are you implying that the above conditions are essential for >>> assignment expressions to be useful, or that this defines one >>> particular way in which they can be of value? >> Hum, maybe I wasn't specific enough. I'm looking for "for loops" and >> list comprehensions in stdlib which *can be* written using assignment >> expression, like: >> >> [var for ... in ... if (var := expr)]. >> >> I'm not discussing if such change is worth it or not. I just counted >> how many for loops/list comprehensions *can* be modified to use >> assingment expressions in the stdlib. >> >> Maybe I missed some loops/comprehensions, and I would be happy to see >> more examples ;-) > Cool. So you're looking for ones that fit a particular pattern that > can benefit, but there are almost certainly other patterns out there. > Just making sure that you weren't trying to say "out of 3360 loops, > exactly 3358 of them absolutely definitely cannot be improved here". Well, if no-one knows how to find something that can be improved, it can't be improved :) > ChrisA > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/vano%40mail.mipt.ru -- Regards, Ivan
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4