Skip to main content

Golang-esque defer functionality

Project description

Defer

PyPi-version PyPi-versions PyPi-license Travis CI CodeCov Codacy Code style: black Code style: prettier Thanks

Add a simple golang-esque deferral system for python.

TODO

  • [x] Add deferrals for a function
  • [x] Tests
  • [x] 95% testing coverage
  • [ ] Add deferrals for a class
  • [ ] Add deferrals for a module

Example

In [1]: import defer

In [2]: @defer.with_defer
   ...: def example_function():
   ...:     print("Hello")
   ...:     defer.defer(print, "!")
   ...:     print("World")
   ...:

In [3]: example_function()
Hello
World
!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for py-defer, version 1.3.0
Filename, size File type Python version Upload date Hashes
Filename, size py_defer-1.3.0-py2.py3-none-any.whl (3.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size py-defer-1.3.0.tar.gz (11.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page