Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
code for scene?
-
I'm looking for the code for the scene module, anyone knows how I can find the code for built-in modules?
-
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 thescene
module'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.py
file, you can see that it imports a_scene2
module, which is compiled:>>> import _scene2 >>> scene2 <module '_scene2' (built-in)>
That means you can read the parts of the
scene
module that are written in Python (scene
), but not those that are compiled (_scene2
).