Changeset 5343:8ea8a9784e51 in livinglogic.python.xist for docs/UL4.rst

Show
Ignore:
Timestamp:
02/12/13 10:58:47 (7 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Allow multiple arguments in UL4 list methods append and insert. Add UL4 dict method update.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • docs/UL4.rst

    r5341 r5343  
    12301230 
    12311231 
     1232``append`` 
     1233"""""""""" 
     1234 
     1235``append`` is a list method. It adds its arguments to the end of the list for 
     1236which it is called:: 
     1237 
     1238    <?code v = [1, 2]?> 
     1239    <?code v.append(3, 4)?> 
     1240    <?print v?> 
     1241 
     1242prints ``[1, 2, 3, 4]``. 
     1243 
     1244 
     1245``insert`` 
     1246"""""""""" 
     1247 
     1248``insert`` is a list method. Its first argument in the insert position, the 
     1249remaining arguments are the intems that will be inserted at that position, so:: 
     1250 
     1251    <?code v = [1, 4]?> 
     1252    <?code v.insert(1, 2, 3)?> 
     1253    <?print v?> 
     1254 
     1255prints ``[1, 2, 3, 4]``. 
     1256 
     1257 
     1258``pop`` 
     1259""""""" 
     1260 
     1261``pop`` is a list method. It removes the last item of the list and returns it. 
     1262If an index is passed the item at that position is removed and returned. 
     1263A negative index is treated as relative to the end of the list. 
     1264 
     1265 
     1266``update`` 
     1267"""""""""" 
     1268 
     1269``update`` is a dictionary method. It supports an arbitrary number of positional 
     1270and keyword arguments. Each positional argument may be a dictionary, all the 
     1271items in the dictionary will be copied to the target dictionary. A positional 
     1272argument may also be an iterable of (key, value) pairs. These will also be copied 
     1273to the target dictionary. After each positional argument is copied over in a last 
     1274step the keyword arguments will be copied to the target dictionary. 
     1275 
     1276 
    12321277Templates as functions 
    12331278====================== 
     
    12521297 
    12531298With this, ``output`` will be the string ``"Javascript"``. 
    1254  
    12551299 
    12561300When no ``<?return?>`` tag is encountered, ``None`` will be returned.