Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Pickling/unpickling extensions types

Reply
Thread Tools

Pickling/unpickling extensions types

 
 
Bob
Guest
Posts: n/a
 
      09-11-2003
I've read over section 3.14.5.2 of the doc about a
zillion times, and it still makes absolutely no sense
to me. Can someone please explain it?

What I'd like to do is, basically, have the object be
pickled as None, since it represents an object in the
C world, and it doesn't make sense to pickle it at
all. How can I do that, if at all?

In particular, what does this

"A callable object, which in the unpickling
environment must be either a class, a callable
registered as a ``safe constructor'' (see below), or
it must have an attribute __safe_for_unpickling__ with
a true value. Otherwise, an UnpicklingError will be
raised in the unpickling environment. Note that as
usual, the callable itself is pickled by name"

mean?

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

 
Reply With Quote
 
 
 
 
Martin v. =?iso-8859-15?q?L=F6wis?=
Guest
Posts: n/a
 
      09-11-2003
Bob <> writes:

> In particular, what does this
>
> "A callable object, which in the unpickling
> environment must be either a class, a callable
> registered as a ``safe constructor'' (see below), or
> it must have an attribute __safe_for_unpickling__ with
> a true value. Otherwise, an UnpicklingError will be
> raised in the unpickling environment. Note that as
> usual, the callable itself is pickled by name"
>
> mean?


What part of it is it that you don't understand? A "callable object"
is one that you can call. E.g. X is callable, if X(some_arguments)
"works":

>>> 1()

Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: 'int' object is not callable
>>> id(id)

1076510860

So the builtin id is callable, the number 1 is not. Examples for
callable objects are functions, bound methods, classes, and objects
whose classes implement __call__.

For "safe constructors", see below in the text.

"Have an attribute" means that getattr works. An object X has an
attribute y if X.y "works".

Regards,
Martin
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can XSD simple types be derived from complex types? Soren Kuula XML 2 12-01-2005 07:51 PM
Unable to access extensions menu or add extensions (I've tried past suggestions) nospam@spam.com Firefox 8 12-01-2005 01:33 AM
Where are ref types that are members of value types stored? Sathyaish ASP .Net 2 05-22-2005 07:32 PM
Boost + Python C/API: Mixing python return types with boost return types Steve Knight Python 2 10-10-2003 10:11 AM
STD types vs C++ intrinsic types Jeremy Cowles C++ 5 08-19-2003 05:33 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57