Python code
π§ Page under construction π§
Here you can find xxx
What Python code style do I use?ΒΆ
We follow the Style Guide for Python Code.
Naming StyleΒΆ
Variables, functions, methods, modules, packages:
lower_case_with_underscoresConstants:
ALL_CAPS_WITH_UNDERSCORESClasses and exceptions:
CapWords
IndentationΒΆ
4 spaces or 1 tab
SpaceΒΆ
Leave space around operators:
var = 4Leave space after commas:
var_1, var_2 = get_values(num_1, num_2)CommentsΒΆ
Comments are introduced with
#, placed above the relevant code, and aligned with the code.
# assign variable
a = 5 Why are comments important? As part of a community, we want code to be readable and reusable by others. Be generous and precise with comments.
How do I quickly translate existing code to Python?ΒΆ
If you already know Python, use Claude Code, ChatGPT, or your AI of preference.
Example prompt:
translate the following code from Matlab to Python: [paste your code]
Important: Double-check the generated output.
If you do not know Python, collaborate with ORMIR members who do.