Advertisement
Guest User

experiments.py

a guest
Feb 4th, 2012
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. import experiments
  2. from experiments import *
  3.  
  4. class PythonImplementation(Communicatable):
  5.     def __init__(self, number):
  6.         Communicatable.__init__(self)
  7.         self.number = number
  8.     def GetMessage(self):
  9.         return self.number
  10.     def Communicate(self, destination):
  11.         destination.Listen(self)
  12.     def Listen(self, originator):
  13.         print "Python: Get message of " + str(originator.GetMessage())
  14.  
  15. c = CImplementation(1337)
  16. p = PythonImplementation(8888)
  17.  
  18. c.Communicate(p)
  19. #When entered manually, c.Communicate(p) yields
  20. #Traceback (most recent call last):
  21. #  File "<stdin>", line 1, in <module>
  22. #TypeError: No to_python (by-value) converter found for C++ type: class boost::shared_ptr<class Communicatable>
  23.  
  24. p.Communicate(c)        # This works okay
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement