Should be noted that this only works on a "statically typeable" subset of Python where every variable has a de facto static type inferred at the first assignment. For instance, the following valid Python code would output invalid C++: var = [] var = 2
auto var = // this type can't be inferred because it's not used
{
auto var = 2;
}
I'm too exhausted to think why this may not be applicable.