[Python-ideas] Quick idea: defining variables from functions that take the variable name

Stephen J. Turnbull stephen at xemacs.org
Thu Jun 2 13:50:25 EDT 2016


Steven D'Aprano writes:

 > If anything, this syntax could be rejected as being too limited and
 > not useful enough,

+1 on that sentiment.

I'm willing to bet that all of these cases are optimizations in any
case.  Otherwise you'd be using "class".  People expect optimized code
to be somewhat uglier than the textbook "teach the idiom" version.
Case in point: the partition exchange sort (more commonly called
"quicksort").  It's actually very easy to understand, it's just the
optimization of in-place sort (well, OK, C don't help) that makes it
look hard.  Don't believe me?  Check it out![1]

https://www.youtube.com/watch?v=bSfe5M_zG2s?start=1895

I don't have anything against nice syntax for optimized code, but I
don't consider your syntax an improvement over the status quo.  Not
that it's outright ugly, just not an improvement.

Steve

Footnotes: 
[1]  The start parm is if you're in a hurry.  The whole keynote is
highly recommended!



More information about the Python-ideas mailing list