
On 31 May 2016, at 02:16, Guido van Rossum <guido@python.org> wrote:
In mypy we have a need for type variables, which are created like this:
from typing import TypeVar
T = TypeVar('T')
I just saw a lightning talk about sympy where they define symbols to be used in mathematical equations, like this:
from sympy import Symbol
x = Symbol('x')
I'm sure this is not a new idea, but so far I've always thought that this is pretty esoteric and the approach here is good enough. But maybe we can actually do better, and whatever solution we come up with might also be useful for extracting attributes from an object or values from a mapping?
Looks like the C #define is what is being asked for. #define SYM( name ) name = Symbol( #name ) SYM( x ) Does python need macro preprocessor? Barry