Re: Iterator addition

2005-11-13 Thread Bengt Richter
On Sun, 13 Nov 2005 17:28:59 -0600, [EMAIL PROTECTED] wrote: [...] > >On Sun, Nov 13, 2005 at 09:44:43PM +, Bengt Richter wrote: >> even if expr1 had a __unaryop__ method, >> expr1 - expr2 >> could not become >> expr1.__unaryop__(-expr2) >> unless you forced the issue with >> expr1

Re: Iterator addition

2005-11-13 Thread jepler
On Sun, Nov 13, 2005 at 09:44:43PM +, Bengt Richter wrote: > even if expr1 had a __unaryop__ method, > expr1 - expr2 > could not become > expr1.__unaryop__(-expr2) > unless you forced the issue with > expr1 (-expr2) as opposed to being a function call? I don't think you've solved

Re: Iterator addition

2005-11-13 Thread Bengt Richter
On Sun, 13 Nov 2005 17:31:32 +0100, Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] wrote: >> Tom Anderson: >>> And we're halfway to looking like perl already! Perhaps a more pythonic >>> thing would be to define a "then" operator: >>> all_lines = file1 then file2 then file3 >>

Re: Iterator addition

2005-11-13 Thread Tom Anderson
On Sun, 13 Nov 2005, Reinhold Birkenfeld wrote: > [EMAIL PROTECTED] wrote: > >> Tom Anderson: > >>> And we're halfway to looking like perl already! Perhaps a more >>> pythonic thing would be to define a "then" operator: >>> >>> all_lines = file1 then file2 then file3 >> >> Or a "chain" one: >> >>

Re: Iterator addition

2005-11-13 Thread Reinhold Birkenfeld
[EMAIL PROTECTED] wrote: > Tom Anderson: >> And we're halfway to looking like perl already! Perhaps a more pythonic >> thing would be to define a "then" operator: >> all_lines = file1 then file2 then file3 > > Or a "chain" one: >> all_lines = file1 chain file2 chain file3 That's certainly not bet

Re: Iterator addition

2005-11-12 Thread bearophileHUGS
Tom Anderson: > And we're halfway to looking like perl already! Perhaps a more pythonic > thing would be to define a "then" operator: > all_lines = file1 then file2 then file3 Or a "chain" one: > all_lines = file1 chain file2 chain file3 Bearophile -- http://mail.python.org/mailman/listinfo/pyt

Re: Iterator addition

2005-11-12 Thread Tom Anderson
On Thu, 9 Nov 2005, it was written: > [EMAIL PROTECTED] (Alex Martelli) writes: > >>> Is there a good reason to not define iter1+iter2 to be the same as >> >> If you mean for *ALL* built-in types, such as generators, lists, files, >> dicts, etc, etc -- I'm not so sure. > > Hmm, there might also be

Re: Iterator addition

2005-11-09 Thread Paul Rubin
[EMAIL PROTECTED] (Alex Martelli) writes: > > Is there a good reason to not define iter1+iter2 to be the same as > If you mean for *ALL* built-in types, such as generators, lists, files, > dicts, etc, etc -- I'm not so sure. Yes, that's what I mean. > Right now, if I mistakenly try to add a list

Re: Iterator addition

2005-11-09 Thread Alex Martelli
Paul Rubin 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,