473,398 Members | 2,427 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,398 software developers and data experts.

Discovery of unpickleables in class heirarchies.

I've a need to pickle arbitrary class hierarchies, which, luckily, can
be made to conform to the pickle protocol. At the moment, however, I'm
having a rather hard time discovering which classes in a heirarchy
cannot be pickles. For instance, say class A has class B in it's
__dict__ and let class B have a file handler in its __dict__. When I
call cPickle.dumps(A) UnpickleableError will be raised when B's file
handler is reached, but the error will only report being unable to
pickle the file handler, saying nothing of B or A. I wouldn't expect
cPickle to do that, but I do need to know somehow that class B has
failed to pickle properly.

To that end I've quickly hacked out a class that, ideally, will take
an object that I'm attempting to pickle and, if the pickling does not
succeed, recurse through the class heirarchy collecting information on
which objects were not pickled. It is here: http://deadbeefbabe.org/paste/5218
The output, for the above example would be:

<type 'A'>
<type 'B'>
<type 'file'>

However, it seems to be taking a rather long time. Perhaps my class
heirarchies are too deep, or my recursion is flawed. Can anyone see a
bug in my code, or have a better way of discovering this information
altogether?

Jun 22 '07 #1
0 917

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Anurag | last post by:
Hi, I understand that the dbm cfg parameter "DISCOVER" controls whether Search or Known discovery is applicable. Additionally, Search discovery provides a superset of Known discovery. I completely...
0
by: Joe Goeke | last post by:
The bluetooth stack that comes with XP SP2 has a couple of nice wizard interfaces for device discovery and pairing. I am looking to create my own wizards to do similar tasks and wanted to interface...
6
by: jason | last post by:
hello everyone, is there any way in C# to perform dynamic property discovery? i know such a thing was possible in C++ template code, but it was kind of an ugly mess. i'm just curious if there is...
3
by: Tim Mavers | last post by:
I am looking for a control (freeware or commercial) that operates like a standard ASP.NET dropdown list, but is able to display heirarchies in the actual dropdown list. This can be similar to a...
0
by: serge calderara | last post by:
Dear all, Let say that I have developped a web service which is host on Server1. Then one of my customer will like to used that service in its own web site which is not based on .NET platform. ...
6
by: razael1 | last post by:
Does anyone know of a good article dealing with organizing large class heirarchies? I've always had trouble with circular dependencies, global constants and variables, etc. Thanks.
4
by: ddtl | last post by:
Hello everybody. Consider the following code: class A(object): def met(self): print 'A.met' class B(A): def met(self):
7
by: Chris Mullins | last post by:
I'm in the process of building a number of (Web) Services using .NET 3.0 and WCF. These services are intended to be deployed within the Intranet of a very, very large orginization. I need to...
0
by: news.microsoft.com | last post by:
Hey All, Sorry to post to several groups but wasn't sure which development group would be best for the question. I was wondering if there are any developers out there that have significant...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.