Skip to content

decorators.postint

sikvelsigma edited this page Aug 21, 2022 · 1 revision

Summery

  • decorator postinit

Adds a call to __postinit__ method after __init__ call was completed

Contains

postinit

from pyuseful.decorators.postinit import postinit

@postinit
class Test:
    def __init__(self):
        self.a = 1
        print("init")

    def __postinit__(self):
        print(self.a)
        print("postinit")

t = Test()

Clone this wiki locally