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

Michael Selik michael.selik at gmail.com
Wed Jun 1 12:54:22 EDT 2016


On Wed, Jun 1, 2016 at 12:33 PM Paul Moore <p.f.moore at gmail.com> wrote:

> On 1 June 2016 at 17:14, Steven D'Aprano <steve at pearwood.info> wrote:
> > We've got two dead-simple use-cases to consider.
>
> There's almost no room for improvement in those two use cases, and yet
> people still like the idea of "not repeating the name".
>

And some people don't!

> T = Typevar('T')
> > x = sympy.Symbol('x')
>

In fact, I often use namedtuple with a dynamic __name__ and fields, without
changing the identifier.

    Record = namedtuple(name, fields)

If I use that in half my code, but then in the other half, something like

    Record => namedtuple(fields)

That's TIMTOWTDI. I'd rather standardize.

Besides, the easy stuff is already easy. Let's focus on what's *hard* in
Python. I haven't seen an explanation of how this proposal would simplify
Django.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160601/fd86f20d/attachment-0001.html>


More information about the Python-ideas mailing list