On Sat, 05 May 2018 20:11:28 +0300, Serhiy Storchaka wrote: >> Why so slow? > > 1. Add an overhead of calling eval(), not just looking up its name. It > is comparable with a time of calling a simple lambda. 2. Add an overhead > of getting the globals dict and creating a locals dict. [...]
Ah, that makes sense. So presumably the fastest way to run some code in Python is to put it into a function and call the function, rather than playing with eval or exec, right? Thanks. -- Steve -- https://mail.python.org/mailman/listinfo/python-list