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

Sven R. Kunze srkunze at mail.de
Tue May 31 09:01:48 EDT 2016


And here we go again. Sorry for posting unfinished stuff:

On 31.05.2016 11:05, Paul Moore wrote:
> 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.
>

I don't know why this needs special syntax anyway. Maybe, somebody could 
explain. Even Guido said it was just for procrastinating. So, I don't 
give much weight to it.


Anyway, what's the difference between:

a = <something>

and

def a = <something>

?

Both evaluate RHS and assign the result to a name (if not already 
defined, define the name)


The only benefit I can see is some a syntax like:

def a

which defines a name in the scope without content. If that's useful? Maybe.


Best,
Sven


More information about the Python-ideas mailing list