开发者

When does running Jython on a .py file generate a .class file?

开发者 https://www.devze.com 2023-03-29 19:18 出处:网络
I just started playing with Jython, and sometimes running jython on a .py file gener开发者_运维技巧ates a .class file, but this doesn\'t always happen.

I just started playing with Jython, and sometimes running jython on a .py file gener开发者_运维技巧ates a .class file, but this doesn't always happen.

At first I thought the trigger was that you had to define a Python class inside the .py file, but evidently a .class file is not always generated even then.

What is the mechanism that triggers the class file?

Thanks.


With regular Python, .pyc files are generated when you import a module but not when it's the __main__ module.

It is the same with Jython -- .class files are generated when you import a Jython module.

You can use jythonc to manually compile a module.

0

精彩评论

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