Raymond Hettinger wrote:
>    <enumerate object: 'A', 'B', 'C', 'D', 'E', 'F'>

I quite like the idea of something along those lines. For example:

try:
  itr = iter(obj)
except TypeError:
  pass
else:
  return "<iterable %s: %s>" % (obj.__class__.__name__,
                                <as for list contents>))

Doing this only in pprint also reduces the chances of accidentally
consuming an iterator (which was a reasonable objection when I suggested
changing the __str__ implementation on some of the standard iterators
some time ago).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to