Python 2.x rarities

Slicing, extended slicing, Ellipsis - a[i:j:step], a[i:j, k:l], a[..., i:j]

More: [1], [2], [3].

>>> class C(object):
... def __getitem__(self, sli):
... print sli
>>> c = C()
>>> c[2, 1:3, 1:4:6, ..., 4:, :6, :, ::-1]
(2, slice(1, 3, None), slice(1, 4, 6), Ellipsis, slice(4, None, None), slice(None, 6, None), slice(None, None, None), slice(None, None, -1))

Negative *round()*

Negative precision affects digits in front of the decimal point:

>>> str(round(1234.5678, -2))
'1200.0'
>>> str(round(1234.5678, 2))
'1234.57'

Reversing a string or a list (well, a sequence)

It’s is as simple as making a copy of it with negative increment: sequence[::-1] - which is equivalent to sequence[-1::-1] (see: Extended slices).