Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

any example to create a Python object on the D side, and call that object's member function passing a D array? #139

Open
mw66 opened this issue Oct 28, 2020 · 0 comments

Comments

@mw66
Copy link
Contributor

mw66 commented Oct 28, 2020

Hi,

I'm looking for an example to create a Python object on the D side, and call that object's member function also from D side.

I.e the D side holds a Python object, and call its method, may also pass in parameters using a D variable.

Is this possible? I checked the /examples dir, but didn't find clue how to do this.

The closest is pydobject/example.d, but it only get a PydObject ints (as list), and loop on it.

Ah, I just saw:

    PydObject random = py_eval("Random()", "random");
    random.method("seed", 234);
    int randomInt = random.randrange(1, 100).to_d!int();
    PydObject otherInt = random.randrange(200, 250);

it can pass string, and int to the PydObject, how to pass a D-array to PydObject?

Thanks.

@mw66 mw66 changed the title any example to create a Python object on the D side, and call that object's member function? any example to create a Python object on the D side, and call that object's member function passing a D array? Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant