Completion of keyword arguments includes arguments from other functions whose names start with the function being completed
- Vorherrschende Sprache
- Python
- Sterne
- 16.8k
- Forks
- 4.5k
- Ø Merge
- 1 T. 2 Std.
- Gemergte PRs (30 T.)
- 6
Beschreibung
For example:

Because `bar_more` starts with `bar`, the completer suggests the keyword arguments of `bar_more`, namely `spam`, which is not a valid argument for `bar`.
The relevant code is [here](https://github.com/ipython/ipython/blob/381c2039723a597eda9679d8f072d075e55c8501/IPython/core/completer.py#L1541-L1558). Specifically:
```python
callableMatches = self.global_matches(ids[0])
```
makes `callableMatches == ['bar', 'bar_more']`, and then arguments are fetched from each match:
```python
for callableMatch in callableMatches:
try:
namedArgs = self._default_arguments(eval(callableMatch,
self.namespace))
```
It's as if it's trying to complete the function name at the same time as the argument, but that makes no sense to me and nothing of the sort ever happens. Am I missing something?
Here's a real case using matplotlib:

The signature of [`plot`](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.plot.html) is just `(*args, **kwargs)`. The arguments suggested come from [`plot_date`](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.plot_date.html) and [`plotfile`](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.plotfile.html). `plot` will actually accept arbitrary arguments without complaining, but I think it's safe to assume at least some of these suggestions are meaningless.
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.