Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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 hashes
Filename, size py-defer-1.3.0.tar.gz (11.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page