3 ms·
Yeah, things liked the nitpick on (1,2,3) == sorted((1,2,3)) seem not really `wats`. sorted returns a list, surprise surprise. The only actual surprise on this
by bpicolo 11y ago
Yeah, things liked the nitpick on (1,2,3) == sorted((1,2,3)) seem not really `wats`. sorted returns a list, surprise surprise.
The only actual surprise on this list is, I agree, that += operator. Especially because tup[0] = tup[0] + [1] fails as expected.
- aldanor 11y agosorted is always a list, whereas reversed is an iterator (at least in Python 3)
- masklinn 11y agoSame in Python 2. A collection can even override "reversed" to provide their own reversed collection/iterator[0], not so for `sorted`. [0] https://docs.python.org/3/reference/datamodel.html?highlight=data%20model#object.__reversed__ https://docs.python.org/3/reference/datamodel.html?highlight...
- tsujamin 11y agothe fact that calling sorted(b) where b is a reversed object affects the following comparison "sorted(b) == sorted(b)" is wierding me out.. Ref: http://pastebin.com/VQs9GSzp http://pastebin.com/VQs9GSzp