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

David Mertz mertz at gnosis.cx
Tue May 31 13:35:01 EDT 2016


Bracketing for a moment what keyword might be used, a thing I like about
this syntax is that it can work for multiple names naturally.  E.g.

    expose Symbol as x, y, z

Or with a different word:

    define Typevar as T, S, R

For things like namedtuple that need more arguments, you'd need to use
functools.partial to create the single argument callable to match the
syntax.
On May 31, 2016 8:44 AM, "Steven D'Aprano" <steve at pearwood.info> wrote:

> On Tue, May 31, 2016 at 08:27:28AM -0700, David Mertz wrote:
> > This is bikeshedding a bit, but a keyword that looks good to me:
> >
> > expose Typevar as T
> > expose Symbol as X
>
> "expose" sounds like it is taking something hidden or private and
> exposing it to the public. It doesn't give any hint that it takes the
> name T and uses it as an argument to Typevar. I would take it as
> meaning:
>
> take the (possibly internal or private) thing Typevar, and bind it to
> the name T
>
> with no hint that Typevar was being called.
>
>
> --
> Steve
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160531/d75d6ba8/attachment-0001.html>


More information about the Python-ideas mailing list