fork(4) download
  1. class Point:
  2. def __init__(self, x, y):
  3. self.x = x
  4. self.y = y
  5. self.next = None
  6.  
  7. def append(self, point):
  8. self.next = point
  9.  
  10. a = Point(2, 3)
  11. b = Point(5, 7)
  12. a.append(b)
  13. print a.next.x
  14. c = Point(10, 15)
  15. b.append(c)
  16. print a.next.next.x
  17.  
Success #stdin #stdout 0.09s 10840KB
stdin
Standard input is empty
stdout
5
10