Hi, 2015-02-09 22:06 GMT+01:00 Neil Girdhar <mistersheik@gmail.com>:
The updated PEP 448 (https://www.python.org/dev/peps/pep-0448/) is implemented now based on some early work by Thomas Wouters (in 2008) and Florian Hahn (2013) and recently completed by Joshua Landau and me.
I don't like this PEP. IMO it makes the Python syntax more complex and more difficult to read. Extract of the PEP:
Current usage of the * iterable unpacking operator features unnecessary restrictions that can harm readability.
Yes, the current syntax is more verbose, but it's simpler to understand and simpler to debug. -- Example:
ranges = [range(i) for i in range(5)] [*item for item in ranges] [0, 0, 1, 0, 1, 2, 0, 1, 2, 3]
I don't understand this code. It looks like you forgot something before *item, I would expect 2*item for example. If it's really to unpack something, I still don't understand the syntax. Does "*" apply to item or to the whole "item for item in ranges"? It's not clear to me. If it applies to the whole generator, the syntax is really strange and I would expect parenthesis: [*(item for item in ranges)]. --
function(**kw_arguments, **more_arguments)
If the key "key1" is in both dictionaries, more_arguments wins, right? I never suffered of the lack of the PEP 448. But I remember that a friend learning Python asked me that * and ** are limited to functions. I had no answer. The answer is maybe to keep the language simple? :-) I should maybe read the PEP one more time and think about it. Victor