Changes between Version 3 and Version 4 of IpaacaTutorial


Ignore:
Timestamp:
12/10/13 11:58:17 (6 years ago)
Author:
yaghoubzadeh
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IpaacaTutorial

    v3 v4  
    4141== Full minimal code examples with annotations == 
    4242 
    43 [[span(style=color: #a0a0a0, `grey`)]] \\ 
    44 [[span(style=color: #a0a0a0, `grey`)]] \\ 
     43[[span(style=color: #a0a0a0, `This is a grey line, please ignore it :)`)]] \\ 
     44 
     45=== Python: IU receiver example / !InputBuffer === 
    4546 
    4647{{{ 
     
    5758                # accessing fields 
    5859                old_value = iu.payload['someKey'] 
    59                 # the next line is a remote write and will only succeed for IUs (not Messages) 
    60                 iu.payload['someKey'] = 'updatedByMeJustNow' 
    61                 # Note: you also should embed remote writes in a try block catching any 
    62                 # IUUpdateFailedError (meaning the IU has been changed remotely in the mean time) 
     60                # the following lines are a remote write and will only succeed for IUs (not Messages) 
     61                try: 
     62                        iu.payload['someKey'] = 'updatedByMeJustNow' 
     63                 
     64                except IUUpdateFailedError, e: 
     65                        print('Failed, retry it or something!') 
     66                        # Note: this means the IU has been changed remotely in the mean time. 
     67                        # The user is responsible for retrying / ignoring / whatever. 
    6368 
    6469# make a new InputBuffer (you can produce any number), with the category interests as a second argument