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/024064.html below:

[Python-Dev] Oberver Pattern

[Python-Dev] Oberver PatternRaymond Hettinger python@rcn.com
Fri, 10 May 2002 19:15:42 -0400
From: "Guido van Rossum" <guido@python.org>
> Again, I think you are being just a dat naive here -- all those jumps
> (that are nearly always taken!) add up, and you're proposing to add
> this to every mutable object.

How about a simpler alternative?

Have just a single field in PyObject_HEAD, int cache_valid.  
Update routines wouldn't even need a jump.  
Everywhere the object assigns a value to ob_item[i], it would also run:  
PyObject_INVALIDATE_CACHE which would expand to:  
   self->cache_valid=0.

The only services would be macros for PyObject_IS_CACHE_VALID(obj)
and PyObject_VALIDATE_CACHE(obj).

> If you *have* to do this, I would implement (at the C level) just a
> single observer object.  If multiple observers are needed, this can
> easily be done using an adapter in Python.

Will do.  Since it's not that hard to implement (meaning, less time than
I spent on iterzip), I may as well try it and time it.


Raymond Hettinge





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