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

David Mertz mertz at gnosis.cx
Tue May 31 21:48:35 EDT 2016


I agree, I saw this after I posted. If the keyword is 'define' the names
should definitely come before 'as'.

If the keyword is 'expose' as I first thought of, the names should come
after 'as'. Other possible words with names after 'as': reveal, publish,
reify, create, etc. If some word is intuitive enough, I'd prefer this
order. It's closer to what 'import' and 'with' do in conjunction with 'as'.
On May 31, 2016 4:58 PM, "Greg Ewing" <greg.ewing at canterbury.ac.nz> wrote:

> David Mertz wrote:
>
>     define Typevar as T, S, R
>>
>
> I quite like this, but it should be the other way around:
>
>    define T, S, R as TypeVar
>
> Yes, I *know* the name being bound comes after 'as' in
> other places, but I think consistency with the obvious
> English meaning is more important.
>
> One other thing, 'define' is so similar to 'def' that
> I think it would be needlessly confusing to have both,
> so just make it
>
>    def T, S, R as TypeVar
>
> Also, yes, you would have to curry if you want the
> constructor to have arguments. I think that's a small
> price to pay for the benefits: less magic, no
> restrictions on the form of the constructor expression,
> and the ability to re-use it for multiple bound names.
>
> --
> Greg
> _______________________________________________
> 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/60804e1c/attachment.html>


More information about the Python-ideas mailing list