Le Thu, 21 Feb 2013 13:35:17 +0000 (UTC), Wolfgang Maier email@example.com a écrit :
Dear all, what do you think about allowing the use of operators on ranges?
I thought of things like: a = range(1,10) b = range(5,12) intersect = a & b # equivalent to intersect = range(5,10) merge = a | b # equivalent to merge = range(1,12)
to make this work in more complex cases, like: a = range(1,10) b = range(12,15) merge = a | b # equivalent to sth. like range(range(1,10),range(12,15))
-1. range() is a contiguous sequence, not an arbitrary container. Simplicity is part of its virtues.