PyD - accessing D class fields in Python
Bastiaan Veelo
Bastiaan at Veelo.net
Tue Mar 19 23:58:48 UTC 2019
On Monday, 18 March 2019 at 22:25:10 UTC, clothlen wrote:
> Howdy;
>
> I'm trying to extend my Python program with D, but I'm having
> trouble accessing a D class's
> field/attribute/property/something.
>
> My D file looks like this:
>
> ```
> module simpletest;
> import pyd.pyd;
> import std.stdio;
>
> class ExampleTest{
> int _a = 3;
> int a(){
> return _a;
> }
> void a(int a){
> this._a = a;
> }
> int b = 4;
> }
>
> extern(C) void PydMain() {
> module_init();
> wrap_class!(
> ExampleTest,
> Property!(ExampleTest.a),
> Property!(ExampleTest.b)
> // Member!("b")
Maybe you need `Member!(“b”, “rw”)`?
> );
> }
If that doesn’t work, maybe you find help by filing an issue on
PyD.
More information about the Digitalmars-d-learn
mailing list