Jason H schrieb am 13.09.2017 um 17:54:
> I'm rather surprised that there isn't a Iterable class which dict and list 
> derive from.
> If that were added to just dict and list, I think it would cover 98% of 
> cases, and adding Iterable would be reasonable in the remaining scenarios.

Would you then always have to inherit from that class in order to make a
type iterable? That would be fairly annoying...

The iterable and iterator protocols are extremely simple, and that's a
great feature.

And look, map() even works with all of them, without inheritance,
registration, and whatnot. It's so easy!

Stefan

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to