开发者

Where to trigger ast modifications in Python?

开发者 https://www.devze.com 2023-01-04 02:44 出处:网络
I\'m doing some AST modifications in Python. This may be done for optimization purpose or other. Where is the right place to put it, so when you do something like:

I'm doing some AST modifications in Python. This may be done for optimization purpose or other.

Where is the right place to put it, so when you do something like:

python myfile.py

or

python runserver.py 开发者_Go百科myapp

the modifications took place for every .py executed file?


Put your modifications in a site.py or sitecustomize.py (Python < 2.6) file (in the lib/site-packages directory ; Python will try to import and run it @ interpreter startup).

0

精彩评论

暂无评论...
验证码 换一张
取 消