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

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Jun 1 16:50:11 EDT 2016


Steven D'Aprano wrote:
> # Your proposal.
> def T as (lambda: Typevar)()
> def x as (lambda: sympy.Symbol)()

No, you would write those as

    def T as TypeVar
    def x as sympy.Symbol

 > Syntactic sugar is supposed to make things easier, not harder.

Which it does, because you have less parentheses to type!

-- 
Greg


More information about the Python-ideas mailing list