Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there generic Python libraries that provide 'signals' (event) capability like Django signals?

I'd like to use something like Django signals in non-Django projects. I thought I'd seen libraries like this in the past, but I've been unable to locate one via the usual searches.

Python's signal library doesn't offer the same capabilities.

like image 617
Inactivist Avatar asked Sep 09 '12 15:09

Inactivist


People also ask

What kind of signals are there in Django?

There are 3 types of signal. pre_save/post_save: This signal works before/after the method save(). pre_delete/post_delete: This signal works before after delete a model's instance (method delete()) this signal is thrown. pre_init/post_init: This signal is thrown before/after instantiating a model (__init__() method).

What is signal library in Python?

What Is Signaling In Python? In simplistic terms, a signal is an event. A signal is used to interrupt the execution of a running function. The signals are always executed in the main Python thread.

Should I use Django signals?

The only reason to use signalsOnly use signals to avoid introducing circular dependencies. If you have two apps, and one app wants to trigger behaviour in an app it already knows about, don't use signals. The app should just import the function it needs and call it directly.

Which of the following Python libraries provides advanced random number capabilities?

NumPy stands for Numerical Python. The most powerful feature of NumPy is n-dimensional array. This library also contains basic linear algebra functions, Fourier transforms, advanced random number capabilities and tools for integration with other low level languages like Fortran, C and C++


1 Answers

There are a number of modules for this. Here are a few options, ordered by what I think their popularity is:

  • The blinker module provides a signal/event mechanism
  • PyDispatcher gives you event dispatch
  • The PySignals module is the Django signals module without any dependency on Django
  • SpiffSignal implements a signal/event framework, but its GitHub page seems to be missing
like image 109
jterrace Avatar answered Sep 19 '22 12:09

jterrace