autowrap icon indicating copy to clipboard operation
autowrap copied to clipboard

Pynih should represent as some kind of standard sensible type in D a python thing that can be anything 8

Open Laeeth opened this issue 6 years ago • 4 comments

Maybe sumtype or Variable

Laeeth avatar Dec 19 '18 00:12 Laeeth

Do you have an example of a Python type that can be anything? Does pyd have something similar?

atilaneves avatar Dec 19 '18 08:12 atilaneves

I think what's meant is a generic "Python Variable" type, so on the D side you can work with something returned from python without knowing at compilation time what type it's going to be.

John-Colvin avatar Dec 19 '18 09:12 John-Colvin

I'm having difficulty imagining how D code could deal with such a generic Python type value in any meaningful way, or what the real-life use case might be. That is, an example would be useful.

atilaneves avatar Dec 19 '18 09:12 atilaneves

Real use is interfacing to SIL. I guess it's a pyobject but often it's going to be something simple like a string or a dict. In which case a bit more work could be done by autowrap. See call python code in SIL stdlib for an example..

Laeeth avatar Dec 20 '18 03:12 Laeeth