example17.py 471 Bytes
Newer Older
Sergey Lyskov's avatar
Sergey Lyskov committed
1
2
3
#!/usr/bin/env python
from __future__ import print_function

4
from example import VectorInt, VectorA, A
Sergey Lyskov's avatar
Sergey Lyskov committed
5
6

v_int = VectorInt(2)
7
print(len(v_int))
Sergey Lyskov's avatar
Sergey Lyskov committed
8

9
print(bool(v_int))
Sergey Lyskov's avatar
Sergey Lyskov committed
10
11

v_int2 = VectorInt(2)
12
print(v_int == v_int2)
Sergey Lyskov's avatar
Sergey Lyskov committed
13
14

v_int2[1] = 1
15
print(v_int != v_int2)
Sergey Lyskov's avatar
Sergey Lyskov committed
16

17
18
v_int2.append(2)
v_int2.append(3)
19
20
21
v_int2.insert(0, 1)
v_int2.insert(0, 2)
v_int2.insert(0, 3)
Sergey Lyskov's avatar
Sergey Lyskov committed
22
23
print(v_int2)

24
25
26
27
v_int.append(99)
v_int2[2:-2] = v_int
print(v_int2)

Sergey Lyskov's avatar
Sergey Lyskov committed
28
v_a = VectorA()
29
30
31
v_a.append(A(1))
v_a.append(A(2))
print(v_a)