mirror of
https://github.com/boostorg/python.git
synced 2026-01-28 19:32:14 +00:00
fixed iteration scheme and added append and extend methods
[SVN r19469]
This commit is contained in:
@@ -300,6 +300,31 @@ e
|
||||
>>> 12345 in v
|
||||
0
|
||||
|
||||
#####################################################################
|
||||
# Show that iteration allows mutable access to the elements
|
||||
#####################################################################
|
||||
>>> v[:] = ['a','b','c','d','e'] # reset again
|
||||
>>> for x in v:
|
||||
... x.reset()
|
||||
>>> print_xvec(v)
|
||||
[ reset reset reset reset reset ]
|
||||
|
||||
#####################################################################
|
||||
# append
|
||||
#####################################################################
|
||||
>>> v[:] = ['a','b','c','d','e'] # reset again
|
||||
>>> v.append('f')
|
||||
>>> print_xvec(v)
|
||||
[ a b c d e f ]
|
||||
|
||||
#####################################################################
|
||||
# extend
|
||||
#####################################################################
|
||||
>>> v[:] = ['a','b','c','d','e'] # reset again
|
||||
>>> v.extend(['f','g','h','i','j'])
|
||||
>>> print_xvec(v)
|
||||
[ a b c d e f g h i j ]
|
||||
|
||||
#####################################################################
|
||||
# END....
|
||||
#####################################################################
|
||||
|
||||
Reference in New Issue
Block a user