plpython

How are import statements in plpython handled?

一笑奈何 提交于 2019-11-29 02:25:12
问题 I have a plypython function which does some json magic. For this it obviously imports the json library. Is the import called on every call to the function? Are there any performance implication I have to be aware of? 回答1: The import is executed on every function call. This is the same behavior you would get if you wrote a normal Python module with the import statement inside a function body as oppposed to at the module level. Yes, this will affect performance. You can work around this by