Customize the effect of enumerate()?

Dustan DustanGroups at gmail.com
Sat Oct 21 07:22:24 EDT 2006


Paul Rubin wrote:
> "Dustan" <DustanGroups at gmail.com> writes:
> > Can I make enumerate(myObject) act differently?
>
> No.
>
> > Why the funny behavior, you ask? For my class A, it doesn't make sense
> > to number everything the standard programming way.
>
> Add an enumerate method to the class then, that does what you want.
> Maybe dict.iteritems would be a better example to follow.

That's what I thought. Thanks anyway!




More information about the Python-list mailing list