enthought / enthought/comtypes

support for named arguments and default argument values

Open
#371 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
345
Forks
105
PR merge metrics
No merged PRs in 30d

Description

'named arguments' feature is 'should be added' since 16 years ago, according to commented(938fbd50d2077c6bd524790a9ed798c3990cdfc0) by Thomas Heller, the originator of this package.

https://github.com/enthought/comtypes/blob/dbe4fa1bed94fef20b9c56faad1693230dd32c43/comtypes/__init__.py#L609-L611

Also, `bound_named_property.__call__` should support them.

https://github.com/enthought/comtypes/blob/dbe4fa1bed94fef20b9c56faad1693230dd32c43/comtypes/__init__.py#L897-L917

If this functionality is added, this code snippet will work!

```py
xl = CreateObject("Excel.Application")
wb = xl.Workbooks.Add()
assert xl.Range["A1:C3"].Address() == "$A$1:$C$3" # it is possible before the functionality is added
assert xl.Range["A1:C3"].Address(None, None) == "$A$1:$C$3" # it is possible before the functionality is added
assert xl.Range["A1:C3"].Address(ColumnAbsolute=False) == "A$1:C$3" # not wroking currently, I want THIS
assert xl.Range["A1:C3"].Address(None, False) == "A$1:C$3" # it is possible before the functionality is added
assert xl.Range["A1:C3"].Address(None, ColumnAbsolute=False) == "A$1:C$3" # not wroking currently, I want THIS
assert xl.Range["A1:C3"].Address(RowAbsolute=False) == "$A1:$C3" # not wroking currently, I want THIS
assert xl.Range["A1:C3"].Address(ReferenceStyle=xlR1C1) == "R1C1:R3C3" # not wroking currently, I want THIS
```

`_DispMemberSpec` has `argspec`, so I think it may be easy to get names and default values.
https://github.com/enthought/comtypes/blob/dbe4fa1bed94fef20b9c56faad1693230dd32c43/comtypes/__init__.py#L1131-L1138
https://github.com/enthought/comtypes/blob/dbe4fa1bed94fef20b9c56faad1693230dd32c43/comtypes/__init__.py#L1155-L1161

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.