Skip to content

Commit

Permalink
chore: Update Python cheatsheet and add Python for Scientists section
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas1312 committed Jun 20, 2024
1 parent 3b70b44 commit 99fa741
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions base/science-tech-maths/programming/languages/python/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- [Python](#python)
- [Cheat Sheets](#cheat-sheets)
- [Python for Scientists](#python-for-scientists)
- [Identity vs equality](#identity-vs-equality)
- [Shallow and Deep Copy](#shallow-and-deep-copy)
- [Name resolution](#name-resolution)
Expand Down Expand Up @@ -93,7 +94,7 @@
- [Where to patch?](#where-to-patch)
- [@mock.patch pitfall: decorator order](#mockpatch-pitfall-decorator-order)
- [@mock.patch.object](#mockpatchobject)
- [Patch dictionnaries](#patch-dictionnaries)
- [Patch dictionary](#patch-dictionary)
- [Property mocking](#property-mocking)
- [Patch constant](#patch-constant)
- [wraps](#wraps)
Expand Down Expand Up @@ -129,7 +130,7 @@
- [Expiring objects](#expiring-objects)
- [Refreshing objects](#refreshing-objects)
- [Expire vs Refresh](#expire-vs-refresh)
- [Flusing objects](#flusing-objects)
- [Flushing objects](#flushing-objects)
- [Committing objects](#committing-objects)
- [Recap](#recap)
- [Pitfalls](#pitfalls)
Expand All @@ -140,6 +141,10 @@

- [Comprehensive Python Cheatsheet](https://gto76.github.io/python-cheatsheet/)

## Python for Scientists

- <https://learn.scientific-python.org/development/>

## Identity vs equality

- use "==" for equality, "is" for identity.
Expand Down Expand Up @@ -1833,7 +1838,7 @@ def test_get_holidays_timeout(mock_requests):
get_holidays()
```

#### Patch dictionnaries
#### Patch dictionary

Besides objects and attributes, you can also patch() dictionaries with patch.dict().

Expand Down Expand Up @@ -2517,7 +2522,7 @@ Expire is a local operation, it does not involve a database query. Refresh is a
- Expire - I persisted some changes for an object to the database. I don't need this updated object anymore in the current method, but I don't want any subsequent methods to accidentally use the wrong attributes.
- Refresh - I persisted some changes for an object to the database. I need to use this updated object within the same method.

### Flusing objects
### Flushing objects

Flushing means to push all object changes to the database.

Expand Down

0 comments on commit 99fa741

Please sign in to comment.