Iterator addition
Alex Martelli
aleax at mail.comcast.net
Wed Nov 9 23:42:06 EST 2005
Paul Rubin <http://phr.cx@NOSPAM.invalid> wrote:
> Is there a good reason to not define iter1+iter2 to be the same as
> itertools.chain(iter1, iter2)?
No -- feel free to define __add__ accordingly in every one of your
iterator classes.
If you mean for *ALL* built-in types, such as generators, lists, files,
dicts, etc, etc -- I'm not so sure. Right now, if I mistakenly try to
add a list to a dict, I get an exception which immediately alerts me to
my mistake. I definitely wouldn't want to lose that...
Alex
More information about the Python-list
mailing list