PyD - accessing D class fields in Python
mw
mingwu at gmail.com
Mon May 17 18:37:56 UTC 2021
On Monday, 17 May 2021 at 17:16:27 UTC, Imperatorn wrote:
> On Monday, 17 May 2021 at 16:54:07 UTC, mw wrote:
>> On Tuesday, 19 March 2019 at 23:58:48 UTC, Bastiaan Veelo
>> wrote:
>>> [...]
>>
>> I filed the issue here (still no response yet):
>>
>> https://github.com/ariovistus/pyd/issues/152
>>
>> [...]
>
> https://github.com/symmetryinvestments/autowrap
Thanks, I just tried, but still cannot get access to class field:
I build this example:
https://github.com/symmetryinvestments/autowrap/tree/master/examples/pyd
and test this:
https://github.com/symmetryinvestments/autowrap/blob/master/examples/pyd/source/class_wrap.d
class Bizzy {
int _m;
...
}
```
$ dub build --config=python36
$ ln -s lib/pyd/libpydtests.so pyd.so
$ python3
>>> import pyd
>>> b = pyd.Bizzy(0)
>>> b
bye(0)
>>> b._m = 3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'pyd.Bizzy' object has no attribute '_m'
```
Add `public` does not work either:
```
class Bizzy {
public int _m;
...
}
```
Any hints?
More information about the Digitalmars-d-learn
mailing list