A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-May/024087.html below:

[Python-Dev] Mutable object change flag

[Python-Dev] Mutable object change flag [Python-Dev] Mutable object change flagRaymond Hettinger python@rcn.com
Sun, 12 May 2002 20:41:26 -0400
As an early step toward implementing an observer pattern, I built a simpler
protocol that sets a mutable object's attribute to zero whenever the object
changes state.

If you guys would like to try it out, see the patch at
www.python.org/sf/555251.  I tried to time the cost of frequent attribute
resets but they were so fast I couldn't produce a measurable difference.


Raymond Hettinger

Here's a sample session:

>>> a = list('abcd')
>>> a.cachevalid
0
>>> a.cachevalid=1
>>> a.cachevalid
1
>>> a[2] = 'k'
>>> a.cachevalid
0





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4