Python — Limits On Number of Imports?

前端 未结 3 572
慢半拍i
慢半拍i 2021-02-14 14:00

I have 1000s of custom (compiled to \'.so\') modules that I\'d like to use in python at the same time. Each such module is of size (100 [KB]) on averag

3条回答
  •  春和景丽
    2021-02-14 14:21

    CPython has no limit on the number of imports. However, each .so file will be opened using dlopen(), which is outside of Python's control -- as is the symbol table that would need to keep growing to collect information about your extension modules. Whether those have a practical limit is also outside of Python's purview. CPython itself merely takes up some memory per module you import, so as long as you have enough memory you should be fine.

提交回复
热议问题