[Python-ideas] set.add() return value

Antoine Pitrou solipsis at pitrou.net
Wed Feb 18 13:58:27 CET 2009


Raymond Hettinger <python at ...> writes:
> 
> Even if it did improve you one app, that would be
> atypical.  Most apps that test and add will do 
> something inside the branch that consumes far more
> time than the contains test. 

Sorry, that argument could be turned into an argument against *any* optimization.

For example, "there's no need to optimize building dict literals, since most
apps will do something with the dict that consumes far more time than building
the dict".

The assumption being that only optimizations which benefit a large class of
applications should be attempted, which is bogus (are large classes of
applications bottlenecked by dict literal creation? yet we have specialized
opcodes for dict literal creation, and so on for lots of other things).





More information about the Python-ideas mailing list