<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Sep 13, 2017 at 10:54 AM, Jason H <span dir="ltr"><<a href="mailto:jhihn@gmx.com" target="_blank">jhihn@gmx.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Thanks for the insights.<br>
I don't think it would be that breaking:<br>
<br>
def remap_map(a1, a2):<br>
  if hasattr(a1, '__call__'):<br>
  Â  return map(a1, a2)<br>
  elif hasattr(a2, '__call__'):<br>
  Â  return map(a2,a1)<br>
  else:<br>
  Â  raise NotCallable # Exception neither is callable<br></blockquote><div><br></div><div>I think it's better to be parsimonious and adhere to the "there is one way to do it" design principle. On the matter of style, map with a lambda is more pleasing as `(expr-x for x in iterable)` rather than `map(lambda x: expr-x, iterable)`. If you need to handle multiple iterables, they can be zip'd.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I'm rather surprised that there isn't a Iterable class which dict and list derive from.<br>
If that were added to just dict and list, I think it would cover 98% of cases, and adding Iterable would be reasonable in the remaining scenarios.</blockquote><div><br></div><div>For checking, there's `collections.abc.Iterable` and neighbors that can look at the interface easily, but I don't think the C-implemented, built-in types spring from them.</div><div><br></div><div>Nick</div></div></div></div>