6 ms·
You don't have to go through all the globals, you just have to get the caller's namespace, which is fairly simple. See e.g. https://stackoverflow.com/a/6618825/
by zephyrfalcon 1y ago
You don't have to go through all the globals, you just have to get the caller's namespace, which is fairly simple. See e.g. https://stackoverflow.com/a/6618825/27426 https://stackoverflow.com/a/6618825/27426
For this reason, I think it's not true that this absolutely had to be a language feature rather than a library. A template class written in pure Python could have done the same lookup in its __init__.
- dec0dedab0de 1y agoThat is exactly what I ended up doing: https://news.ycombinator.com/item?id=43752889 https://news.ycombinator.com/item?id=43752889