You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), "build"))
from example import Dog, call_go
class tinyDog(Dog):
def __init__(self):
Dog.__init__(self)
def go(self, n):
result = ""
for i in range(n):
result += "tiny woof!"
return result
a = Dog()
print("Dog:", call_go(a))
b = tinyDog()
print("tinyDog in call_go:", call_go(b))
print("tinyDog's own go:", b.go(3))
`
when I run this py, I got results as below:
Dog: woof! woof! woof!
tinyDog in call_go: woof! woof! woof!
tinyDog's own go: tiny woof!tiny woof!tiny woof!
while what I want is as below:
Dog: woof! woof! woof!
tinyDog in call_go: tiny woof!tiny woof!tiny woof!
tinyDog's own go: tiny woof!tiny woof!tiny woof!
how can I do that? any help would be appriciated!!!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi I am new to pybind, I am running a class example of pybind, my code is as below:
example.cpp:
`
tinyDog.py:
`
when I run this py, I got results as below:
Dog: woof! woof! woof!
tinyDog in call_go: woof! woof! woof!
tinyDog's own go: tiny woof!tiny woof!tiny woof!
while what I want is as below:
Dog: woof! woof! woof!
tinyDog in call_go: tiny woof!tiny woof!tiny woof!
tinyDog's own go: tiny woof!tiny woof!tiny woof!
how can I do that? any help would be appriciated!!!
Beta Was this translation helpful? Give feedback.
All reactions