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

Greg Ewing greg.ewing at canterbury.ac.nz
Tue May 31 19:57:27 EDT 2016


David Mertz wrote:

>     define Typevar as T, S, R

I quite like this, but it should be the other way around:

    define T, S, R as TypeVar

Yes, I *know* the name being bound comes after 'as' in
other places, but I think consistency with the obvious
English meaning is more important.

One other thing, 'define' is so similar to 'def' that
I think it would be needlessly confusing to have both,
so just make it

    def T, S, R as TypeVar

Also, yes, you would have to curry if you want the
constructor to have arguments. I think that's a small
price to pay for the benefits: less magic, no
restrictions on the form of the constructor expression,
and the ability to re-use it for multiple bound names.

-- 
Greg


More information about the Python-ideas mailing list