geldata / geldata/gel-python

Improve the Transaction docs to include patterns for unbound variables

Open
#553 0 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Python
Stars
415
Forks
50
PR merge metrics
No merged PRs in 30d

Description

Our current Transaction API makes it slightly more difficult to use variables bound within the transaction block, since linters and other static analysis tools cannot know that the iterator is every invoked on our transaction iterable. Given that, we should give better examples of how to deal with those tools, and explain more of the philosophy here.

Suggested pattern is:

```py
my_var = None

async for tx in client.transaction():
async with tx:
my_var = …

assert my_var is not None

# use my_var without linter warnings or errors
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.