Hi,
I'm observing some strange behaviour in spyder (latest checkout) when I
call a property on a class in the IPython console. Namely, when the
property is called on a single line it appears to be called twice. When
part of a multi-line block it seems to execute (correctly) only once. I'm
posting to the spyder list as I don't observe this behaviour in the
qtconsole by itself. Example below.
Teo
In [1]: import time
In [2]: class Test(object):
...: def __init__(self, value):
...: print "Entered constructor of
{}".format(self.__class__.__name__)
...: self._value = value
...:
...: def value_method(self):
...: print "Inside value_method @", time.clock()
...: time.sleep(1)
...: return self._value
...:
...: @property
...: def value_property(self):
...: print "Inside value_property @", time.clock()
...: time.sleep(1)
...: return self._value
In [3]: t = Test(1)
Entered constructor of Test
In [4]: t.value_method(); print time.clock()
Inside value_method @ 9.62387953982e-07
0.999820514647
In [5]: t.value_property; print time.clock()
Inside value_property @ 11.167314033
Inside value_property @ 12.1696252076
13.1693008829
In [6]: t.value_property;
...: print time.clock()
...:
Inside value_property @ 245.980576605
246.980280671
In [7]: from IPython import sys_info
...: print sys_info()
...:
{'codename': 'An Afternoon Hack',
'commit_hash': 'af2a228',
'commit_source': 'repository',
'default_encoding': 'cp1252',
'ipython_path': 'c:\\dev\\code\\ipython\\IPython',
'ipython_version': '2.0.0-dev',
'os_name': 'nt',
'platform': 'Windows-7-6.1.7600',
'sys_executable': 'C:\\dev\\bin\\Python27\\python.exe',
'sys_platform': 'win32',
'sys_version': '2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit
(Intel)]'}
--
You received this message because you are subscribed to the Google Groups
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/spyderlib.
For more options, visit https://groups.google.com/groups/opt_out.