[Python-ideas] Quick idea: defining variables from functions that take the variable name
contrebasse at gmail.com
Tue May 31 10:12:05 EDT 2016
Steven D'Aprano <steve at ...> writes:
> How do you feel about an arrow operator?
> T -> TypeVar()
> x -> Symbol()
> T -> type(bases, ns)
> Record -> namedtuple(fields)
> In general:
> name [, name, ...] -> callable(...)
> where "callable" is some expression, e.g. a name, a dot lookup, etc.
It could work with indexing, like:
key -> my_dict
key = my_dict[key]
Or even attribute lookup with a trailing dot:
attr -> my_object.
attr = my_object.attr
More information about the Python-ideas