• [Python-announce] objerve 0.2.0

    From furkanonder@furkanonder@protonmail.com to comp.lang.python.announce on Mon Sep 12 10:50:42 2022
    From Newsgroup: comp.lang.python.announce

    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/--- Synchronet 3.19c-Linux NewsLink 1.113