Jump to content
Sign in to follow this  
IanH9999

PPyObject V's Variant

Recommended Posts

I'm finding that to use the various functions and procedures within the library I'm having to convert between instances of PPyObject and Variants a lot, but I have no idea why.

 

I can see that the VarPyth.pas header states that that it allows you to use Python objects like COM automation objects, but I'm having trouble understanding the relationship between the two. For example, when calling BuiltInModule.setattr why do I need to pass a Variant rather than a PPyObject?

 

 

Share this post


Link to post
1 hour ago, IanH9999 said:

 

I can see that the VarPyth.pas header states that that it allows you to use Python objects like COM automation objects, but I'm having trouble understanding the relationship between the two. For example, when calling BuiltInModule.setattr why do I need to pass a Variant rather than a PPyObject?

The mechanism that Delphi uses to dispatch such calls does not support it.

 

You need some consistency.  Either you use the low-level Python interface and PPyObjects or VarPyth and custom variants.  Although you can easily convert PPyObjects to Variants and back (VarPythonCreate, ExtractPythonObjectFrom), sticking to one of the two simplifies life.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×