add complex class test
This is a bug report actually:
$ cat c.py
c = complex(2,-1)
h = c.__hash__();
print(c)
print(h)
# python output
$ python c.py
(2-1j)
-2000004 # here!
however, pyd output:
$ dub build
$ ./simple_embedded
1 + 2
(2-1j)
<method-wrapper '__hash__' of complex object at 0x7fa8c49897d0> # here!
I just found the work around how to make the pyd call:
auto h = c.__hash__()();
I think here we should use the python convention:
c.__hash__; // return the method-wrapper
c.__hash__(); // return the result of the function call.
Ah, yeah, that's kind of annoying. I would certainly like it if I could get D to do as you suggest, but there is no way (or wasn't last time I checked, admittedly a while) to get opDispatch to distinguish between obj.property and obj.property(). So we have this kind of compromise where no parameters are treated as obj.property and presence of parameters are treated as a method call.
OK, I added the work-around, so new user can follow the example to make the call.
@ariovistus: I'm a git idiot, I tried to add python39 support (which I have been used for a year without problem on my local machine), but I messed up my PR and my local branches.
It should be just a single file PR (commit hash 170ac4b) for dub.json:
https://github.com/ariovistus/pyd/pull/143/commits/170ac4b2094de249c8588a3cafd59ab6bfafc64f
If you have time, can you separate this file as a single PR and merge it, then we can have python39 support.
Thanks.
done