Replies: 2 comments
-
|
That makes sense to me, but I'm not sure I have all the context - what do we currently generate and how does that change in your proposal? What was the motivation for allowing "user-written" subclasses in that other PR rather than doing this in the first place? |
Beta Was this translation helpful? Give feedback.
-
|
Well, all this was and still is a step by step learning process for me. Therefore the implementation wasn't done as straightforward as it probably could have been done by someone with a good general understanding of COM and the pywin32 code structure. The situation at the moment is that nothing has changed as long as the user doesn't take action himself, i.e. all What the user has to do for making use of the and register this class with With such a definition and registration, a COM record of this type can be created with a call to the constructor What I'm proposing is to create definitions like the one above for all There are a few things to consider:
The first point could be addressed by implementing an optional parameter in Regarding the second point: While If we already create the class definitions in This could be accomplished e.g. with a decorator: and a decorator definition like this: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When implementing
pythoncom.com_recordas a subclassable Python type in PR #2437, @mhammond wanted to assure that it doesn't introduce non deterministic behaviour. To address this issue, a subclass has to be explicitly registered withwin32com.client.register_record_classbefore it can be used within the pywin32 machinery.Although documentation was added that explains this mechanism, it doesn't seem to be very well recognised.
In addition, even when using
makepy, it currently keeps the burden to manually define the subclasses and register them on the user.I would like to discuss the idea to automatically generate the subclasses for
structsdefined in a TypeLibrary and register them bymakepy. They would initially live in the namespace of the module generated bymakepy.I would argue that a user who runs
makepyor usesEnsureDispatchcan not only expect to work with static dispatch objects instead of generic COM objects but also to get TypeLibrary specific class instances instead of genericpythoncom.com_recordobjects.Further points of discussion could be:
makepyand alike to prevent or explicitly enable this automatic generation?__all__member of the module to enable a wild card import?Beta Was this translation helpful? Give feedback.
All reactions