documentation: add code style to CONTRIBUTING#5649
documentation: add code style to CONTRIBUTING#5649sueszli wants to merge 2 commits intoxdslproject:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5649 +/- ##
=======================================
Coverage 86.25% 86.25%
=======================================
Files 403 403
Lines 56660 56660
Branches 6512 6512
=======================================
Hits 48871 48871
Misses 6268 6268
Partials 1521 1521 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@alexarice @math-fehr @jumerckx, what do you think of these? These are supposed to be for new contributors and for various coding assistants to hopefully make more consistent choices with the ones we're aiming for when developing in xDSL. Do you agree with all the points? Anything missing? |
| - We follow the Python philosophy of | ||
| "[ask for forgiveness not permission](https://docs.python.org/3/glossary.html#term-eafp)": | ||
| we assume valid keys or attributes exist and catch exceptions if the assumption proves | ||
| false. This leads to cleaner, more Pythonic code: | ||
|
|
||
| ```python | ||
| # Good | ||
| try: |
There was a problem hiding this comment.
I don't think I've ever written a try-catch in xDSL, but if people prefer this I'll adapt :)
There was a problem hiding this comment.
I relatively recently discovered it and I've tried to stick to it since then
|
I like these. Makes choices such as preferring to manually inline more explicit |
|
Whoops - Not sure why the pipeline broke. |
Based on: https://github.com/sueszli/xdsl/blob/51e33a370d14d6c4858d58ce22911427d38b791b/CONTRIBUTING.md