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

Nikolaus Rath Nikolaus at rath.org
Tue May 31 13:12:12 EDT 2016


On May 31 2016, Steven D'Aprano <steve-iDnA/YwAAsAk+I/owrrOrA at public.gmane.org> wrote:
> How do you feel about an arrow operator?
>
>
> T -> TypeVar()
> x -> Symbol()
> T -> type(bases, ns)
> Record -> namedtuple(fields)

Solves the problem nicely, but difficult to memorize. I'd always expect
the RHS to be evaluated first, and *then* somehow be connected to the
LHS.

How about a special placeholder?

Record -> namedtuple($me, fields)
Record := namedtuple($me, fields)

or maybe even

Record = namedtuple($me, fields)

*duck*


(yeah, I guess I'd like to see $ get semantics in Python)


Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«


More information about the Python-ideas mailing list