Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

A signal one to one event

Project description

Slinker provide a single one to one event, we call it a link.

A link can only have a single sender and a single reciver.

The source code is locate at github .

Build Status


Link receiver can subscribe to specific link. A reciver function required a sender argument, and a keyworld argument which is optional.

>>> from slinker import Namespace
>>> links = Namespace()
>>> started ='round-started')
>>> def each(round):
...     print "Round %s!" % round
>>> started.connect(each)
>>> for round in range(1, 4):
...     started.send(round)
Round 1!
Round 2!
Round 3!

Here provide a decorator receiver which can be used for connect. Because a link can only have one reciever. If you want to connect to another receiver, you must disconnect the formly receiver.

>>> started.disconnect(each)
>>> from slinker import receiver
>>> @receiver(started)
    def test(sender, **kwargs):
...     return sender
>>> func, result = started.send('hello')
>>> func == test
... True
>>> result == 'hello'
...  True

More examples

see the tests directory.

Project details

Release history Release notifications | RSS feed

This version


Download files

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

Files for slinker, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size slinker-0.1.tar.gz (6.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page