George Sakkis wrote: > The base object class would be one candidate, similarly to the way > __nonzero__ is defined to use __len__, or __contains__ to use __iter__. > > Alternatively, iter() could be a wrapper type (or perhaps mixin) > instead of a function, something like:
so you're proposing to either make *all* objects respond to "+", or introduce limited *iterator* algebra. not sure how that matches the OP's wish for "mostly backwards compatible" support for *iterable* algebra, really... (iirc, GvR has shot down a few earlier "let's provide sugar for iter- tools" proposals. no time to dig up the links right now, but it's in the python-dev archives, somewhere...) </F> -- http://mail.python.org/mailman/listinfo/python-list