Author RPecor
Recipients RPecor
Date 2021-07-27.21:41:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1627422107.77.0.358238210778.issue44752@roundup.psfhosted.org>
In-reply-to
Content
After making a class using the @property decorator to implement a getter, using tab completion that matches the getter function name executes the function. 

See below for example (line numbers added, <tab> indicates when the user presses the tab key):

1  >>> class Foo(object):
2  ...     def __init__(self,value):
3  ...         self.value = value
4  ...     @property
5  ...     def print_value(self):
6  ...         print("Foo has a value of {}".format(self.value))
7  ... 
8  >>> bar = Foo(4)
9  >>> bar.<tab>~~~Foo has a value of 4~~~
10 <tab>~~~Foo has a value of 4~~~
11 
12 bar.print_value  bar.value        
13 >>> bar.p<tab>~~~Foo has a value of 4~~~
14 <tab>rint_value~~~Foo has a value of 4~~~
15 ~~~Foo has a value of 4~~~
16 
17 bar.print_value
18 >>> bar.v<tab>alue

I pressed tab after typing "bar." in line 9. It then printed the remainder of line 9 and moved the cursor to line 10. Pressing tab again prints line 10 and 11 before finally showing the expected output on line 12. lines 13-17 follow the same steps, but after typing "bar.p" to show that it happens whenever you tab and it matches the getter. Line 18 shows a correct tab completion resulting from hitting tab after typing "bar.v" which does not match the getter function.
History
Date User Action Args
2021-07-27 21:41:47RPecorsetrecipients: + RPecor
2021-07-27 21:41:47RPecorsetmessageid: <1627422107.77.0.358238210778.issue44752@roundup.psfhosted.org>
2021-07-27 21:41:47RPecorlinkissue44752 messages
2021-07-27 21:41:47RPecorcreate