please help shrink this each_with_index() implementation

Antoine Pitrou solipsis at pitrou.net
Tue Jan 5 21:28:08 EST 2010


> The point: int('') or int('something') both throw an error. In general,
> this is hand-holding, but in specific I don't think the "rich and
> structured" documentation will cover how to beat a 0 out of it in less
> than 3 lines.

Because it's a bad idea to do so and Python doesn't encourage such sloppy 
behaviour. If you like it, though, you might prefer PHP.

By the way: error reporting is definitely *not* hand-holding. It is 
simply not good to let errors pass silently by default. Again, if you 
think the contrary, PHP is your friend ;-)




More information about the Python-list mailing list