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

Paul Moore p.f.moore at gmail.com
Tue May 31 05:05:35 EDT 2016


On 31 May 2016 at 09:56, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> I know you don't think a keyword works for you, but
> either the recently reraised "def <name> = <type-expr>" or perhaps
> "type <name>: <type-expr>" make more sense to me right out of the box.

I was thinking along the lines of "name <some_keyword> callable",
which I don't think works because it needs some "punctuation" to
separate the name from the callable.

But "def name = callable" (or some other preceding keyword combined
with =) might work. I don't like "type" though, as the point here (I
thought - see below) is to come up with a construct useful for more
than just types.

> I'm +1 for stopping the bikeshedding until we've all got a lot of
> stubfile reading under our belts.

If this was simply about type definitions, I'd agree. But I thought
the point of Guido's post was that having seen two examples (TypeVar
and Symbol) is there a more general approach that might cover these
two cases as well as others? So just looking at the problem in terms
of stub files isn't really the point here.

Paul


More information about the Python-ideas mailing list