Python is faster than C

Hye-Shik Chang perky at i18n.org
Sun Apr 4 01:41:35 EST 2004


On Sat, Apr 03, 2004 at 09:44:38PM -0800, Raymond Hettinger wrote:
> [Armin Rigo] 
> > >>> enumerate([6,7,8,9])         # uh ?
> > <enumerate object at 0x401a102c>
> 
> This got me thinking about how much I would like to see the contents
> of an iterator at the interactive prompt.
> 
> I wonder if the read-eval-print loop could be trained to make a better
> display:
[snip]
> 
> # intended result
> >>> enumerate('abcdefgh')
> <enumerate object at 0x401a102c:  (0, 'a') (1, 'b') (2, 'c') ...>
> >>> list(_)
> [(0, 'a'), (1, 'b'), (2, 'c'), (3, 'd'), (4, 'e'), (5, 'f'), (6, 'g'),
> (7, 'h'), (8, 'i'), (9, 'j'), (10, 'k'), (11, 'l'), (12, 'm'), (13,
> 'n')]
> 

Yeah!  I love this idea.  It may make not only enumerate() but also
reverse() and itertools internal objects more interactive-friendly.


Hye-Shik




More information about the Python-list mailing list