Re: itertools.count() as built-in

2006-05-29 Thread Raymond Hettinger
[EMAIL PROTECTED] wrote: > Is there any chance of itertools.count() ever becoming one of the > built-in functions? That's unlikely. The goal is to have fewer builtins rather than more. Utility and frequency are not the only considerations; otherwise glob.glob, sys.stderr, print.pprint, copy.copy,

Re: itertools.count() as built-in

2006-05-29 Thread Alex Martelli
Duncan Smith <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Zipping an xrange? I'm having trouble visualizing how you do that to > > avoid x*i+y. > > > > -Janto > > > > Something like, > > >>> lis = ['a', 'b', 'c', 'd'] > >>> y = 3 > >>> i = 7 > >>> for n, item in zip(xrange(y, len

Re: itertools.count() as built-in

2006-05-29 Thread Duncan Smith
[EMAIL PROTECTED] wrote: > Zipping an xrange? I'm having trouble visualizing how you do that to > avoid x*i+y. > > -Janto > Something like, >>> lis = ['a', 'b', 'c', 'd'] >>> y = 3 >>> i = 7 >>> for n, item in zip(xrange(y, len(lis)*i+y, i), lis): print n, item 3 a 10 b 17 c

Re: itertools.count() as built-in

2006-05-29 Thread [EMAIL PROTECTED]
Zipping an xrange? I'm having trouble visualizing how you do that to avoid x*i+y. -Janto -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.count() as built-in

2006-05-29 Thread [EMAIL PROTECTED]
Oops. The messed-up version wasn't supposed to be messed-up. Two mistakes on one line. Which kinda proves my point :) I'd much rather use the count version than (1) or (2). (1) has the problem of having "incorrect" values the rest of the time in the loop and (2) is going to an extreme just to avoi

Re: itertools.count() as built-in

2006-05-28 Thread John Machin
On 29/05/2006 9:50 AM, [EMAIL PROTECTED] wrote: > I have a project of around 6000 lines where I used count() 20 times. It > has 14 modules, 10 of which I needed an explicit import. > > Many of the usages are of the form: > > for item, n in zip(items, count(N)): > dostuff > > Around half of thes

Re: itertools.count() as built-in

2006-05-28 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I have a project of around 6000 lines where I used count() 20 times. It > has 14 modules, 10 of which I needed an explicit import. > > Many of the usages are of the form: > > for item, n in zip(items, count(N)): > dostuff > > Around half of these

Re: itertools.count() as built-in

2006-05-28 Thread [EMAIL PROTECTED]
Oh and I use repeat, chain and cycle quite a bit. But I don't mind importing them as they are usually limited to one module. -- http://mail.python.org/mailman/listinfo/python-list

Re: itertools.count() as built-in

2006-05-28 Thread [EMAIL PROTECTED]
I have a project of around 6000 lines where I used count() 20 times. It has 14 modules, 10 of which I needed an explicit import. Many of the usages are of the form: for item, n in zip(items, count(N)): dostuff Around half of these are due to using pylab.subplot(x,y.n), which requires values for

Re: itertools.count() as built-in

2006-05-28 Thread John Machin
On 29/05/2006 4:14 AM, [EMAIL PROTECTED] wrote: > Is there any chance of itertools.count() ever becoming one of the > built-in functions? It's a wonderful little function and I find myself > importing it in every module I write. > Every module?? Do you use any/many other itertools functions? Care

itertools.count() as built-in

2006-05-28 Thread [EMAIL PROTECTED]
Is there any chance of itertools.count() ever becoming one of the built-in functions? It's a wonderful little function and I find myself importing it in every module I write. -Janto -- http://mail.python.org/mailman/listinfo/python-list