[Python-ideas] Modern language design survey for "assign and compare" statements

Steven D'Aprano steve at pearwood.info
Mon May 21 19:50:55 EDT 2018


On Mon, May 21, 2018 at 10:00:01AM -0700, Mike Miller wrote:

> It is true that := handles more (perhaps less-common) use cases, but 
> subjectively it is not as "Pythonic."  Also doesn't appear to be the 
> direction the surveyed languages are going.

Your conclusion does not follow even from the limited sample of 
languages you looked at. Out of the five languages you surveyed, three 
include some form of assignment expressions. It completely collapses if 
we look at a more extensive sample of languages dating back to 2009.

If we limit ourselves to the three clear "winners" since 2009 (languages 
which have significant, if still niche, popularity/relevance according 
to TIOBE), we find all three:

Coffeescript, Go, Swift

have some form of assignment expressions. Go's is very limited: only in 
"if" statements. Coffeescript and Swift allow assignment expressions 
anywhere.



-- 
Steve


More information about the Python-ideas mailing list