470,596 Members | 1,657 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,596 developers. It's quick & easy.

Upgrading Class Instances Automatically on Reload

Upgrading Class Instances Automatically on Reload:
Recipe 20.15 out of Python Cookbook #2.
Did anybody get this recipe to work?

The original example by Michael Hudson works without problems.
I'm using Python 2.4.1

malv

May 10 '06 #1
4 1842
malv:
Did anybody get this recipe to work?


Did you?

--
René Pijlman
May 10 '06 #2
Rene,

No, I couldn't get it to work. Sorry, I should have included that
information.

At the statement b = Bar(), the following error occurs:
The debugged program raised the exception unhandled AttributeError
"type object 'Bar' has no attribute '__instance_refs__'"

malv

May 10 '06 #3
malv:
At the statement b = Bar(), the following error occurs:
The debugged program raised the exception unhandled AttributeError
"type object 'Bar' has no attribute '__instance_refs__'"


I haven't studied it at all, but the code on
http://aspn.activestate.com/ASPN/Coo.../Recipe/160164 seems to
run fine with Python 2.4.2 in WingIDE on Windows XP. There's no exception
and it prints:
1
2
3

Are you perhaps using an older dead tree version of the Cookbook?

--
René Pijlman
May 10 '06 #4
Indeed, as I indicated the old recipe/160164 by Michael Hudson works
flawlessly for me.

I am referring here to the latest edition: cookbook #2 which features
an upgraded version.
You find the examples in:
http://examples.oreilly.com/pythonco...2_examples.zip

The files are named cb2_6_21_*.py, but the book has the recipe in
chapter
20.15.

malv

May 10 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Carlos Ribeiro | last post: by
6 posts views Thread by Brian Jones | last post: by
30 posts views Thread by Neil Zanella | last post: by
3 posts views Thread by chrisspen | last post: by
9 posts views Thread by Dave Kelly | last post: by
6 posts views Thread by Tim Hunter | last post: by
33 posts views Thread by Peng Yu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.