A really bad idea.

Carl Banks imbosol at vt.edu
Fri Nov 15 16:20:18 EST 2002


Daniel Dittmar wrote:
>> But these are your *opinions*.  
> 
> No. These are criteria (or whatever the plural of criterion is), 
> although of course there isn't a strict line between 'readable' and 'not 
> readable'.

These are criteria not everyone considers important.  To me, ability
to search for something has nothing to do with its readability.


> Most Python programmers will agree that putting something 
> into a library is generally a better choice than inventing a new syntax. 

Usually this is true, if it is something that a library function is
capable of.  There are a few things in Python that have their own
syntax where a library function will do (print, exec), but not many.

However, list comprehensions have their own syntax because it's
impossibe to do them with a function.  This was not a case of someone
saying, "we could do this as a function, but it's so important that we
have to define a new syntax for it."


> Where some disagree is if building a list is so common that a new syntax 
> makes the code actually more readable because the intentions are more 
> explicit.

Some might argue that list comprehensions are not useful enough or too
unsightly to justify adding complexity to the language, but no correct
thinker would argue that it should have been a function instead of a
new syntax.



-- 
CARL BANKS



More information about the Python-list mailing list