On 11/14/06, George Sakkis <[EMAIL PROTECTED]> wrote: > On 11/14/06, Mike Klaas <[EMAIL PROTECTED]> wrote:
> > I don't see the problem of importing important language functionality. > > Most languages since c have required somthing similar. > > Most languages since C are not as readable and elegant as Python. I > think we all agree that list1[5:] + list2 is much better than the > hypothetical > list1.getslice(5,None).concatenate(list2) > or > from sequenceutils import concatenate, getslice > concatenate(getslice(list1,5,None), list2) > > Unfortunately, people here seem to consider natural the latter when it > comes to itertools. Oh well, whatever. Two differences: - slicing an iterator is a rare activity; slicing a list is common - I often use .extend rather than += when appending iterables to lists Finally, your analogy between sequences and iterators is flawed. + does not work for sequences, but only for concrete types: >>> [8] + (9,) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can only concatenate list (not "tuple") to list In python, only concrete types tend to implement syntatic operator support (another example: sets only support +, -, |, & with other sets, but their methods accept iterables). -Mike _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
