Read Watches
Project description
### Disclaimer
dutc = Don't Use This Code (!!)
# Compatibility
* Python 3.5 or higher
* Linux or OS X
* need build toolchain (prob. need `gcc`)
# Read Watches in Python
```python
>>> import rwatch # enable functionality
>>> from sys import setrwatch, getrwatch
>>> x, y, z = object(), object(), object()
>>> def view(frame, obj):
... print(frame, obj)
... return obj
...
>>> setrwatch({id(x): view, id(y): view})
>>> getrwatch()
{139825758638208: <function view at 0x7f2bb89a59d8>, 139825758638224: <function view at 0x7f2bb89a59d8>}
>>> x
<frame object at 0x7f2bb8ad9ba8> <object object at 0x7f2bb8ac9080>
<object object at 0x7f2bb8ac9080>
>>> y
<frame object at 0x7f2bb8ad9d48> <object object at 0x7f2bb8ac9090>
<object object at 0x7f2bb8ac9090>
>>> z
<object object at 0x7f2bb8ac90a0>
```
# Lessons:
* read watches are a very useful tool for debugging
* it's actually very useful for a language to have a runtime
* there are some hidden equivalencies between, e.g., read watches and perfect proxy objects
dutc = Don't Use This Code (!!)
# Compatibility
* Python 3.5 or higher
* Linux or OS X
* need build toolchain (prob. need `gcc`)
# Read Watches in Python
```python
>>> import rwatch # enable functionality
>>> from sys import setrwatch, getrwatch
>>> x, y, z = object(), object(), object()
>>> def view(frame, obj):
... print(frame, obj)
... return obj
...
>>> setrwatch({id(x): view, id(y): view})
>>> getrwatch()
{139825758638208: <function view at 0x7f2bb89a59d8>, 139825758638224: <function view at 0x7f2bb89a59d8>}
>>> x
<frame object at 0x7f2bb8ad9ba8> <object object at 0x7f2bb8ac9080>
<object object at 0x7f2bb8ac9080>
>>> y
<frame object at 0x7f2bb8ad9d48> <object object at 0x7f2bb8ac9090>
<object object at 0x7f2bb8ac9090>
>>> z
<object object at 0x7f2bb8ac90a0>
```
# Lessons:
* read watches are a very useful tool for debugging
* it's actually very useful for a language to have a runtime
* there are some hidden equivalencies between, e.g., read watches and perfect proxy objects
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dutc-rwatch-0.1.0.tar.gz
(45.9 kB
view hashes)
Built Distribution
Close
Hashes for dutc_rwatch-0.1.0-py3.5-linux-x86_64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b7ed60827cac285f9e27497c931e158aa2c9ed0e91eb5eac58d94eede0ff19c |
|
MD5 | 9a8489260be42a706d2b01539fddde53 |
|
BLAKE2b-256 | 951f1c3dce3f3435bca735c660b0c7da1c4836f7baba7e6ee651d23f8445c0ed |