Cute 'proxy' with __new__
Aahz
aahz at pythoncraft.com
Tue Dec 31 00:13:50 EST 2002
In article <pan.2002.12.30.21.55.44.730039 at compy.attbi.com>,
<jerf at compy.attbi.com> wrote:
>
> loadedFiles = {}
> def __new__(cls, filename, init = None):
> try: return cls.loadedFiles[filename]
> except: pass
You should update your try/except to catch specific exceptions; what
happens if the user presses ctrl-C?
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"There are three kinds of lies: Lies, Damn Lies, and Statistics." --Disraeli
More information about the Python-list
mailing list