Python's iterable unpacking is what Lispers might call a destructuring bind.
py> iterable = 1, 2, 3, 4, 5
py> a, b, *rest = iterable
py> a, b, rest
(1, 2, (3, 4, 5))
Clojure also supports mapping destructuring. Let's add that to Python!
py> mapping = {"a": 1, "b": 2, "c": 3}
py> {"a": x, "b": y, "c": z} = mapping
py> x, y, z
(1, 2, 3)
py> {"a": x, "b": y} = mapping
Traceback:
ValueError: too many keys to unpack
This will be …
[View More]approximately as helpful as iterable unpacking was before PEP
3132 (https://www.python.org/dev/peps/pep-3132/).
I hope to keep discussion in this thread focused on the most basic form of
dict unpacking, but we could extended mapping unpacking similarly to how
PEP 3132 extended iterable unpacking. Just brainstorming...
py> mapping = {"a": 1, "b": 2, "c": 3}
py> {"a": x, **rest} = mapping
py> x, rest
(1, {"b": 2, "c": 3})
[View Less]
I have read the python3.5 docs for super() and
https://rhettinger.wordpress.com/2011/05/26/super-considered-super/.
Between the two sources I still have no clear idea of what super() will
do and why it will doe what it does.
I hope to get feedback that can be used as the basis to update the python docs.
For single inheritance the use of super() does not seem to have any surprises.
But in the case of a class with multiple-inheritance more then 1 function
may be called by 1 call to super().
…
[View More]What are the rules for which functions are called by super() in the multiple
inheritance case?
Is __init__ special or can other super() calls end up
calling more then 1 function?
What is the role of **kwds with super()?
Here is the code I used to show the __init__ multiple calls.
The attached example shows that one call to super() causes 2 to
__init__ of bases of Person. But describe does not follow the pattern
Age.describe is not called.
Barry
[View Less]