BJörn Lindqvist: > > One might perversely allow extension to lists and tuples to allow > > [3, 4] in [1, 2, 3, 4, 5, 6] > > to succeed, but that's forcing the use case beyond normal limits. The > > point I am trying to make is that circumstances alter cases, and that we > > can't always rely on our intuition to determine how specific methods > > work, let alone whether they are available. > > I'd love to have that! There are at least one million use cases for > finding a sequence in a sequence and implementing it yourself is > non-trivial. Plus then both list and tuple's index methods would work > *exactly* like string's. It would be easier to document and more > useful. A big win.
Sublist search (and generally adding a bit of pattern matching features to Python) looks far from being perverse, it may even become pythonic ;-) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list