[Python-announce] objerve 0.2.0

furkanonder via Python-announce-list <[email protected]>
Newsgroups gmane.comp.python.announce
Message-ID <ezhMmbn7it5LWt0aWdY0AV8QY0o9gmhhX4bawDnwfiptypjax1daqYaVWlbpSQbsedjmKlkEZJkF75P38G31vvsxiNdXuoWdJH7vM3sYuXI=@protonmail.com>
Announcing objerve 0.2.0
=========================

PyPI: https://pypi.org/project/objerve/0.2.0/
Pip: ``pip install objerve==0.2.0``
Source: https://github.com/furkanonder/objerve/

What is objerve?
-----------------
Objerve is a tiny observer for Python object attributes that only use one decorator.

Example
-------------------------
from objerve import watch

@watch(set={"foo", "qux"}, get={"bar", "foo"})
class M:
qux = "blue"

def __init__(self):
self.bar = 55
self.foo = 89
self.baz = 121

m = M()

def abc():
m.foo += 10

m.qux = "red"
abc()
m.foo

Output:

Set | foo = 89
File "/home/blue/example.py", line 9, in __init__
self.foo = 89

Set | qux = red
File "/home/blue/example.py", line 18, in <module>
m.qux = "red"

Get | foo = 89
File "/home/blue/example.py", line 16, in abc
m.foo += 10

Set | foo = 99
File "/home/blue/example.py", line 16, in abc
m.foo += 10

Get | foo = 99
File "/home/blue/example.py, line 20, in <module>
m.foo

Enjoy,
Furkan Onderhttps://github.com/furkanonder/
_______________________________________________
Python-announce-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.