[ python-Feature Requests-1191699 ] make slices pickable
SourceForge.net
noreply at sourceforge.net
Sun Jul 16 20:55:12 CEST 2006
Feature Requests item #1191699, was opened at 2005-04-28 13:44
Message generated for change (Comment added) made by connelly
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1191699&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Sebastien de Menten (sdementen)
Assigned to: Raymond Hettinger (rhettinger)
Summary: make slices pickable
Initial Comment:
As suggested by the summary, provide pickability of
slices by default.
Currently one has to use copy_reg module to register
slices as pickables.
----------------------------------------------------------------------
Comment By: Connelly (connelly)
Date: 2006-07-16 18:55
Message:
Logged In: YES
user_id=1039782
Additional use case: I needed picklable slices when logging method calls to a
database: __setitem__(self, i, x) could not be logged because the database
module attempted to pickle objects such as ('__setitem__', slice(1, 2, 3), []).
For other Python users who have run into this problem: the code needed to
make slices picklable by copy_reg is available at:
http://mail.python.org/pipermail/python-list/2004-November/
248988.html
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2005-06-03 00:50
Message:
Logged In: YES
user_id=80475
Okay, sounds reasonable. Will implement when I have time.
----------------------------------------------------------------------
Comment By: Sebastien de Menten (sdementen)
Date: 2005-04-30 18:02
Message:
Logged In: YES
user_id=820079
Use case for pickable slices.
Let A be a numeric array of size M x N. We want to consider
sub-arrays in this array like A[:4, :] (the first 4 lines of the
array).
If we want to store both the array and the information of
sub-arrays structures, we need to store slices (we can also
store start/end indices of the array ... but this is call a slice
so it would be better to have pickable slices).
In fact, whenever one wants to write generic algorithm
working on "sublist of lists" or "subarrays of arrays" or
"sub-items of collection of items", it is nicer to use slice
objects explicitly and so store them also explicitly.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2005-04-30 12:32
Message:
Logged In: YES
user_id=80475
Use cases?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1191699&group_id=5470
More information about the Python-bugs-list
mailing list