code for scene?
ellie_ff1493 last edited by
I'm looking for the code for the scene module, anyone knows how I can find the code for built-in modules?
dgelessus last edited by
Many of the Pythonista-specific modules are written in C (or Objective-C) and compiled, so you can't see the source code for them. To find out if that's the case, import and look at the module in the Python console:
>>> import console >>> console <module 'console' (built-in)>
The "built-in" part means that the module is compiled and not written in Python.
Some modules (like
scene) are actually made of two modules: the main module is written in Python, and it imports a second module that is compiled. For example, you can see the location of the
scenemodule's Python code:
>>> import scene >>> scene <module 'scene' from '/var/containers/Bundle/Application/.../Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/scene.py'>
However if you look into the
scene.pyfile, you can see that it imports a
_scene2module, which is compiled:
>>> import _scene2 >>> scene2 <module '_scene2' (built-in)>
That means you can read the parts of the
scenemodule that are written in Python (
scene), but not those that are compiled (