diff options
| author | William S Fulton <wsf@fultondesigns.co.uk> | 2020-08-15 16:46:01 +0100 |
|---|---|---|
| committer | William S Fulton <wsf@fultondesigns.co.uk> | 2020-08-15 16:46:01 +0100 |
| commit | 89bee6a7fa2236da8f10bf200abdc4892d4085b8 (patch) | |
| tree | b4a6efa27ad38a2e7146a91b6832b80631c0c677 /Examples/python/callback | |
| parent | 2af35cb4ff80f352aa2f8f2b02bfd31000db4188 (diff) | |
| download | swig-89bee6a7fa2236da8f10bf200abdc4892d4085b8.tar.gz | |
Modify examples to be both Python 2 and 3 compatible
For removing dependency on 2to3
Diffstat (limited to 'Examples/python/callback')
| -rw-r--r-- | Examples/python/callback/runme.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Examples/python/callback/runme.py b/Examples/python/callback/runme.py index 345a3eb6e..41deb8386 100644 --- a/Examples/python/callback/runme.py +++ b/Examples/python/callback/runme.py @@ -11,7 +11,7 @@ class PyCallback(example.Callback): example.Callback.__init__(self) def run(self): - print "PyCallback.run()" + print("PyCallback.run()") # Create an Caller instance @@ -20,8 +20,8 @@ caller = example.Caller() # Add a simple C++ callback (caller owns the callback, so # we disown it first by clearing the .thisown flag). -print "Adding and calling a normal C++ callback" -print "----------------------------------------" +print("Adding and calling a normal C++ callback") +print("----------------------------------------") callback = example.Callback() callback.thisown = 0 @@ -29,9 +29,9 @@ caller.setCallback(callback) caller.call() caller.delCallback() -print -print "Adding and calling a Python callback" -print "------------------------------------" +print("") +print("Adding and calling a Python callback") +print("------------------------------------") # Add a Python callback (caller owns the callback, so we # disown it first by calling __disown__). @@ -40,9 +40,9 @@ caller.setCallback(PyCallback().__disown__()) caller.call() caller.delCallback() -print -print "Adding and calling another Python callback" -print "------------------------------------------" +print("") +print("Adding and calling another Python callback") +print("------------------------------------------") # Let's do the same but use the weak reference this time. @@ -53,5 +53,5 @@ caller.delCallback() # All done. -print -print "python exit" +print("") +print("python exit") |
