>>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) >>> c = OrderedDict(((0, 3), (3, 2), (2, 1))) >>> e = OrderedDict(d) >>> c >= d False >>> d >= c True >>> d >= dict(c) Traceback (most recent call last): TypeError: Can only
(self, other)
| 257 | return (self.items() > other.items()) |
| 258 | |
| 259 | def __ge__(self, other): |
| 260 | """ |
| 261 | >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) |
| 262 | >>> c = OrderedDict(((0, 3), (3, 2), (2, 1))) |
| 263 | >>> e = OrderedDict(d) |
| 264 | >>> c >= d |
| 265 | False |
| 266 | >>> d >= c |
| 267 | True |
| 268 | >>> d >= dict(c) |
| 269 | Traceback (most recent call last): |
| 270 | TypeError: Can only compare with other OrderedDicts |
| 271 | >>> e >= d |
| 272 | True |
| 273 | """ |
| 274 | if not isinstance(other, OrderedDict): |
| 275 | raise TypeError('Can only compare with other OrderedDicts') |
| 276 | # FIXME: efficiency? |
| 277 | # Generate both item lists for each compare |
| 278 | return (self.items() >= other.items()) |
| 279 | |
| 280 | def __repr__(self): |
| 281 | """ |