Skip to content

loynoir/defer.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

defer.py

golang defer equivalent in python

Install

pip install git+https://github.com/loynoir/defer.py

Usage

from Defer import Defer

with Defer() as defer:
    print("enter the room")
    defer(lambda: print("leave the room"))

    print("prepare printer")
    defer(lambda: print("close printer"))

    print("start printing")
    defer(lambda: print("end printing"))

    print(3)
    print(4)
    print(5)
    print("LONG LONG TASKS")

About

golang defer equivalent in python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages