Feb. 23, 2014
6:52 p.m.
Ron Adam writes:
The operator you want is one for an in place method call.
seq = [] .= extend(get_data()) .= sort()
That looks like anything but Python to me. If I really thought of that as a single operation, I'd do something like class ScarfNSort(list): def __init__(self): self.extend(get_data()) self.sort() seq = ScarfNSort() If it doesn't deserve a class definition, then the repeated references to 'seq' wouldn't bother me. N.B. '.=' shouldn't be called "in-place": 'sort' and 'extend' are already in-place. The word would be "chain," "cascade," or similar.