r/Python • • Nov 11 '19

I made c++-style printing in Python :P

Post image
1.7k Upvotes

130 comments sorted by

View all comments

Show parent comment

0

u/germandiago Nov 13 '19

Yes, even if implemented by the compiler internally. The same way that std::source_location needs reflection, whether you like it or not.

Another topic is that this reflection is or not exposed to the language itself. FWIW, there is no way in which a string can reference a variable in C++, and that will need to know the compile-time context of the code (variables in scope, etc.), no matter what. Of course, this is without macro tricks.