Ezio Melotti
2015-11-09 22:15:43 UTC
# <tab> is used to indicate when/where I press <tab>
... @property... def bar(self): print('Foo.bar called')
...
f = Foo()
f.<tab>Foo.bar called
Foo.bar calledf.<tab>Foo.bar called
Foo.bar called
Foo.bar called
<tab>Foo.bar called
Foo.bar called
Foo.bar called
Foo.bar called
<tab>
f.__class__( f.__doc__ f.__getattribute__( f.__le__( f.__new__( f.__setattr__( f.__weakref__
f.__delattr__( f.__eq__( f.__gt__( f.__lt__( f.__reduce__( f.__sizeof__( f.bar
f.__dict__ f.__format__( f.__hash__( f.__module__ f.__reduce_ex__( f.__str__(
f.__dir__( f.__ge__( f.__init__( f.__ne__( f.__repr__( f.__subclasshook__(
f.b<tab>Foo.bar called
Foo.bar calledFoo.bar called
Foo.bar called
ar<enter>
Foo.bar called
Each time I press <tab>, the property is called 4 times. I'm not sure why the value is accessed at all, but even if there was a valid reason to do so, doing it once should be enough.
----------
messages: 254415
nosy: ezio.melotti
priority: normal
severity: normal
stage: test needed
status: open
title: tab-completition on instances repeatedly accesses attribute/descriptors values
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6
_______________________________________
Python tracker <***@bugs.python.org>
<http://bugs.python.org/issue25590>
_______________________________________