Skip to content

...METHOD and ...PROPERTY return _MemberSpecs instead of tuples #367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 3, 2022

Conversation

junkmd
Copy link
Collaborator

@junkmd junkmd commented Nov 3, 2022

STDMETHOD, COMMETHOD, DISPMETHOD, and DISPPROPERTY return tuples of complex elements.

This reduces the readability of the code flow and makes type annotation difficult.

They should return instances of the other classes, as commented(938fbd5) by Thomas Heller, the originator of this package.

comtypes/comtypes/__init__.py

Lines 1092 to 1093 in b331d3c

# XXX STDMETHOD, COMMETHOD, DISPMETHOD, and DISPPROPERTY should return
# instances with methods, or at least accessors instead of tuple.

Elements of _methods_ and _disp_methods_ specify members of that type.
They should be 'private classes', instantiated only through these functions.

Therefore, they are named _FooMemberSpec.

They have __iter__ method, so that they can be used as unpackable objects like tuple.

In future PRs, I plan to change the existing code to reference their attributes and without unpacking them.

vasily-v-ryabov added a commit to vasily-v-ryabov/pywinauto that referenced this pull request Nov 3, 2022
@vasily-v-ryabov vasily-v-ryabov merged commit dbe4fa1 into enthought:master Nov 3, 2022
@junkmd junkmd deleted the add_memberspecs branch November 3, 2022 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants