diff options
author | jason kirtland <jek@discorporate.us> | 2010-07-21 11:07:13 +0100 |
---|---|---|
committer | jason kirtland <jek@discorporate.us> | 2010-07-21 11:07:13 +0100 |
commit | fa3be696ab410308191ed4af804a31d2ba60144d (patch) | |
tree | 3cfd919986622a0d5857967480d4c95d7e69cc2c /docs/source/signals.rst | |
parent | 50ac3faf7d154b6bd57ed3341dae3a31cab82013 (diff) | |
download | blinker-fa3be696ab410308191ed4af804a31d2ba60144d.tar.gz |
Added Signal.connect_via() decorator.
Diffstat (limited to 'docs/source/signals.rst')
-rw-r--r-- | docs/source/signals.rst | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/source/signals.rst b/docs/source/signals.rst index 8bb967a..b17338f 100644 --- a/docs/source/signals.rst +++ b/docs/source/signals.rst @@ -184,7 +184,19 @@ be used as a decorator on functions: While convenient, this form unfortunately does not allow the ``sender`` or ``weak`` arguments to be customized for the connected -function. +function. For this, :meth:`~Signal.connect_via` can be used: + +.. doctest:: + + >>> dice_roll = signal('dice_roll') + >>> @dice_roll.connect_via(1) + ... @dice_roll.connect_via(3) + ... @dice_roll.connect_via(5) + ... def odd_subscriber(sender): + ... print("Observed dice roll %r." % sender) + ... + >>> result = dice_roll.send(3) + Observed dice roll 3. Optimizing Signal Sending |