[Python-ideas] Fwd: Extremely weird itertools.permutations
Tim Peters
tim.peters at gmail.com
Mon Oct 14 01:44:14 CEST 2013
[Oscar Benjamin]
> Will this do?
> d = TransformDict(lambda x: (type(x), x))
No. In the example I gave, *lists* will be passed as x (it was a list
of lists: the lists are the elements of the permutations, and they
happen to have internal structure of their own). So the `type(x)`
there is useless (it will always be the list type), while the lists
themselves would still be compared by operator.__eq__.
Not to mention that the constructed tuple isn't hashable anyway (x is
a list), so can't be used by TransformDict.
So that idea doesn't work several times over ;-)
More information about the Python-ideas
mailing list