473,237 Members | 1,131 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,237 software developers and data experts.

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 1924
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Carlos Ribeiro | last post by:
I'm looking for ways to load new class definitions at runtime (I'm not talking about object instances here, so a persistent object database isn't what I am looking for ). I'm aware of a few...
6
by: Brian Jones | last post by:
I'm sure the solution may be obvious, but this problem is driving me mad. The following is my code: class a(object): mastervar = def __init__(self): print 'called a'
30
by: Neil Zanella | last post by:
Hello, Suppose I have some method: Foo::foo() { static int x; int y; /* ... */ }
3
by: chrisspen | last post by:
Is there a way to loop through all instantiated objects and update their classes when a source file changes? I know about Michael Hudson's method...
9
by: Dave Kelly | last post by:
I have generated a class, which contains configuration data for my application. Unfortunately I cannot use a static implementation of the class, as it requires a constructor. I generate...
6
by: Tim Hunter | last post by:
I am using Access 2003 under WinXP. I currently support a huge Excel Wokbook that is a maintenance nightmare. There are about 15 worksheets each with lots of formulas...Anyway I am thinking of...
5
by: kkirtac | last post by:
Hi, i have a class "myClass", and i want to return two instances of the same class from a function. I define an array as follows : "myClass sample ;" and i initialize two instances: "myClass...
33
by: Peng Yu | last post by:
Hi, __PRETTY_FUNCTION__ is a macro that gives function name, etc. I'm wondering if there is a macro to get the class name inside a member function. Thanks, Peng
0
by: idealfellow | last post by:
Hi Guys, I have multiple Mysql DB instances containing same schema but different data in the tables, running in my unix server. I always have the issue of not upgrading...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.