diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2019-03-12 19:37:22 -0700 |
|---|---|---|
| committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2019-03-13 11:13:05 +0000 |
| commit | 03bb44dd2ca1e4ff8cd53469e2c5f2fa5361c084 (patch) | |
| tree | bccb9a142f7fa2f1a02f5fb0feb96153e073e5cd /doc | |
| parent | 18f5d5ad05b1df2d1ac9fad8aa2e65be02b7553f (diff) | |
| download | psycopg2-03bb44dd2ca1e4ff8cd53469e2c5f2fa5361c084.tar.gz | |
Convert `while 1:` statements to `while True:`
A slightly more readable and modern syntax.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/src/advanced.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/src/advanced.rst b/doc/src/advanced.rst index 993f29f..ff0137d 100644 --- a/doc/src/advanced.rst +++ b/doc/src/advanced.rst @@ -12,7 +12,7 @@ More advanced topics conn.commit() def wait(conn): - while 1: + while True: state = conn.poll() if state == psycopg2.extensions.POLL_OK: break @@ -285,7 +285,7 @@ something to read:: curs.execute("LISTEN test;") print "Waiting for notifications on channel 'test'" - while 1: + while True: if select.select([conn],[],[],5) == ([],[],[]): print "Timeout" else: @@ -347,7 +347,7 @@ together with the Python :py:func:`~select.select` function in order to carry on asynchronous operations with Psycopg:: def wait(conn): - while 1: + while True: state = conn.poll() if state == psycopg2.extensions.POLL_OK: break @@ -468,7 +468,7 @@ example callback (using `!select()` to block) is provided as `psycopg2.extras.wait_select()`: it boils down to something similar to:: def wait_select(conn): - while 1: + while True: state = conn.poll() if state == extensions.POLL_OK: break |
