Magnus Lycka wrote: > Bryan Olson wrote: > >> Magnus Lycka wrote: >> >>> Do you really have a usecase for this? It seems to me that your >>> argument is pretty hollow. >> >> >> Sure: >> >> if item_triggering_end in collection: >> handle_end(whatever) >> collection.clear() >> >> Or maybe moving everything from several collections into >> a single union: >> >> big_union = set() >> for collection in some_iter: >> big_union.update(t) >> collection.clear() > > > I don't understand the second one. Where did 't' come from?
Cut-and-past carelessness. Meant to update with 'collection'. > Anyway, tiny code snippets are hardly usecases. The task is the usecase. [...] > I still don't see any convincing usecase for the kind of > ducktyping you imply. I didn't say I could convince you. I said that when different types can support the same operation, they should also support the same interface. That's what enables polymorphism. -- --Bryan -- http://mail.python.org/mailman/listinfo/python-list