#6 examples errors: kwargs

v3.1.2
closed
schoenborno
3
2013-08-03
2012-04-26
schoenborno
No

Contribution from Kurt Mueller:

On http://pubsub.sourceforge.net/apidocs/modules_setup.html under Kwargs Messaging Protocol:

from pubsub import pub

def listener(hi): assert msg == 123
pub.subscribe(listener, 'someTopic')

def listener2(hi, foo): assert hi == 123; assert foo = 'bar'
pub.subscribe(listener2, 'someTopic.subTopic')

pub.sendMessage('someTopic.subTopic', hi=123, foo='bar')

I think there are at least two errors:

def listener(hi): assert msg == 123

should read:

def listener(hi): assert hi == 123

And

def listener2(hi, foo): assert hi == 123; assert foo = 'bar'

should read:

def listener2(hi, foo): assert hi == 123; assert foo == 'bar'

Discussion

  • schoenborno
    schoenborno
    2013-08-03

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,28 +1,34 @@
     Contribution from Kurt Mueller: 
    
    -On
    -http://pubsub.sourceforge.net/apidocs/modules_setup.html
    -under Kwargs Messaging Protocol:
    +On http://pubsub.sourceforge.net/apidocs/modules_setup.html under Kwargs Messaging Protocol:
    
    ----------------------------------------------------------------
    -from pubsub import pub
    +    :::python
    +    from pubsub import pub
    
    -def listener(hi): assert msg == 123
    -pub.subscribe(listener, 'someTopic')
    +    def listener(hi): assert msg == 123
    +    pub.subscribe(listener, 'someTopic')
    
    -def listener2(hi, foo): assert hi == 123; assert foo = 'bar'
    -pub.subscribe(listener2, 'someTopic.subTopic')
    +    def listener2(hi, foo): assert hi == 123; assert foo = 'bar'
    +    pub.subscribe(listener2, 'someTopic.subTopic')
    
    -pub.sendMessage('someTopic.subTopic', hi=123, foo='bar')
    ----------------------------------------------------------------
    +    pub.sendMessage('someTopic.subTopic', hi=123, foo='bar')
    
     I think there are at least two errors:
    
    +    :::python
    +    def listener(hi): assert msg == 123
    
    -def listener(hi): assert msg == 123
     should read:
    -def listener(hi): assert hi == 123
    
    -def listener2(hi, foo): assert hi == 123; assert foo = 'bar'
    +    :::python
    +    def listener(hi): assert hi == 123
    +
    +And 
    +
    +    :::python
    +    def listener2(hi, foo): assert hi == 123; assert foo = 'bar'
    +
     should read:
    -def listener2(hi, foo): assert hi == 123; assert foo == 'bar'
    +
    +    :::python
    +    def listener2(hi, foo): assert hi == 123; assert foo == 'bar'
    
    • Group: --> v1.0_(example)
     
  • schoenborno
    schoenborno
    2013-08-03

    • status: open --> closed
    • Group: v1.0_(example) --> v3.1.2
     
  • schoenborno
    schoenborno
    2013-08-03

    Fixed in SVN