
On Fri, Jul 28, 2017 at 9:31 AM, Chris Barker <chris.barker@noaa.gov> wrote:
On Thu, Jul 27, 2017 at 2:50 PM, Chris Angelico <rosuav@gmail.com> wrote:
On Fri, Jul 28, 2017 at 7:22 AM, Pavol Lisy <pavol.lisy@gmail.com> wrote:
maybe: for x, y, z from spam: print(x, y, z)
What you're asking for is something like JavaScript's "object destructuring" syntax.
Wasn't there just a big long discussion about something like that on this list?
Yeah, and the use cases just aren't as strong in Python. I think part of it is because a JS function taking keyword arguments looks like this: function fetch(url, options) { const {method, body, headers} = options; // ... } fetch("http://httpbin.org/post", {method: "POST", body: "blah"}); whereas Python would spell it this way: def fetch(url, *, method="GET", body=None, headers=[]): ... fetch("http://httpbin.org/post", method="POST", body="blah"); So that's one big slab of use-case gone, right there. ChrisA