Beispiel #1
0
import hello

planet = hello.World(5, 6)
planet2 = hello.World("hollo world")

i = planet.sum_s()
print(i)

s = planet2.greet()
print(s)
Beispiel #2
0
import hello
planet = hello.World()
planet.set('howdy')
print(planet.greet())
Beispiel #3
0
import hello
planet = hello.World()  #this class should be exposed to python
planet.set('foo')


def multiply(a, b):
    print planet.greet()
    print "Will compute", a, "times", b
    c = 0
    for i in range(0, a):
        c = c + b
    return c
import hello
hi = hello.World("Hello World!")
print(hi.greet())
hi = hello.World()
print(hi.greet())
hi.set("Hello There!")
print(hi.greet())

var = hello.Var("pi")
var.value = 3.14
print(f"{var.name} is {var.value}")

num = hello.Num(2.7)
print(num.value, num.rovalue)
num.value = 2.8131
print(num.value, num.rovalue)

base = hello.factory()
print(base.fun())
print(hello.doFunBase(base))
print(hello.doFunDerived(base))

class Derived(hello.Base):
    def fun(self):
        return "Python Derived"

derived = Derived()
print(derived.fun())
print(hello.doFunBase(derived))
Beispiel #5
0
import hello

planet = hello.World("hollo world")
s = planet.greet()
print(s)
planet.set('howdy')
s = planet.greet()
print(s)