Updated some examples

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@490 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2000-06-17 21:41:01 +00:00
commit b3e124ac21
22 changed files with 745 additions and 96 deletions

View file

@ -1,24 +1,24 @@
#!/home/sci/local/bin/python
#
# Python test script. This also illustrates the use of get/set
# for C variables.
from example import *
print get_time()
print "My Variable = ", cvar.My_variable
for i in range(0,14):
n = fact(i)
print i, "factorial is ", n
for i in range(1,250):
for j in range(1,250):
n = mod(i,j)
cvar.My_variable = cvar.My_variable + n
print "My_variable = ", cvar.My_variable
# file: example.py
import example
# Call our gcd() function
x = 42
y = 105
g = example.gcd(x,y)
print "The gcd of %d and %d is %d" % (x,y,g)
# Manipulate the Foo global variable
# Output its current value
print "Foo = ", example.cvar.Foo
# Change its value
example.cvar.Foo = 3.1415926
# See if the change took effect
print "Foo = ", example.cvar.Foo