[issue33124] Lazy execution of module bytecode

Josh Rosenberg report at bugs.python.org
Wed Mar 28 11:18:32 EDT 2018


Josh Rosenberg <shadowranger+python at gmail.com> added the comment:

Serhiy: There is a semi-common case where global constants can be quite expensive, specifically, initializing a global full of expensive to compute/serialize data so it will be shared post-fork when doing multiprocessing on a POSIX system. That said, that would likely be a case where lazy initialization would be a problem; you don't want each worker independently initializing the global lazily.

Also, for all practical purposes, aren't enums and namedtuples global constants too? Since they don't rely on any syntax based support at point of use, they're just a "function call" followed by assignment to a global name; you couldn't really separate the concept of global constants from enums/namedtuple definitions, right?

----------
nosy: +josh.r

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33124>
_______________________________________


More information about the Python-bugs-list mailing list