classification
Title: IDLE call hints and completions confused by ints and floats
Type: behavior Stage:
Components: IDLE Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: epaine, terry.reedy, wyz23x2
Priority: normal Keywords:

Created on 2020-07-10 08:49 by wyz23x2, last changed 2020-07-11 21:04 by terry.reedy.

Messages (3)
msg373455 - (view) Author: wyz23x2 (wyz23x2) * Date: 2020-07-10 08:49
There is a function hex(number, /), and float objects have a method hex().
When something like 1.3.hex( is typed, the yellow box's first line contains hex(number, /). But the method is actually hex(), no arguments. It confuses users.
And when 1.3.list( is typed, there isn't a list() method in floats, but the hint still pops up and shows the __doc__ for list(iterable=(), /).
msg373528 - (view) Author: E. Paine (epaine) * Date: 2020-07-11 17:11
Both of the following cases give the correct popup help information:

float.hex(

And:

t = type("test_hex", (), {"hex": lambda nothing: None})
t.hex(

The reason your case fails is because IDLE doesn't evaluate `1.3` to a float and does indeed use the normal `hex` method help (as you established with your `list` test).
msg373539 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-07-11 21:04
Neither '1 .bit_length()' (space required) nor '1.3.hex()', both legal syntax, get either proper completions or call hints.  Neither does the erroneous syntax '1.bit_length'. This suggests that the backwards parsing from the final '.' could be improved.  The first place to look would be whatever common code there is in hyperparser.

(Side note: something.x<tab> tabs if no completions are found.  Should inproved doc on this.)
History
Date User Action Args
2020-07-11 21:04:00terry.reedysettype: behavior
title: Wrong hint when class methods and builtins named same -> IDLE call hints and completions confused by ints and floats
messages: + msg373539
versions: - Python 3.7
2020-07-11 17:11:59epainesetnosy: + epaine
messages: + msg373528
2020-07-10 08:49:55wyz23x2create