[issue3489] add rotate{left,right} methods to bytearray

2013-05-18 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I think we can close. issue17100 would have been more useful actually.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3489
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3489] add rotate{left,right} methods to bytearray

2013-05-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think you rather need the inplace shift operation. Or even the move the tail 
of buffer to the start without filling the remaining. I.e. something like

buffer[:size] = buffer[-size:]

but without creating immediate bytes object. Now it may be written as:

buffer[:size] = memoryview(buffer)[-size:]

--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3489
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3489] add rotate{left,right} methods to bytearray

2013-05-18 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
resolution:  - rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3489
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3489] add rotate{left,right} methods to bytearray

2013-05-17 Thread Ethan Furman

Ethan Furman added the comment:

Antoine, do you want to pursue, or can we close this?

--
nosy: +ethan.furman

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3489
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3489] add rotate{left,right} methods to bytearray

2010-08-11 Thread Raymond Hettinger

Changes by Raymond Hettinger rhettin...@users.sourceforge.net:


--
priority: normal - low
stage: unit test needed - 

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3489
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3489] add rotate{left,right} methods to bytearray

2010-08-09 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

Antoine, do you disagree with Raymond or should we close this?
In any case, I believe this would delayed by the moratorium.

--
nosy: +terry.reedy
versions: +Python 3.3 -Python 2.7, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3489
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3489] add rotate{left,right} methods to bytearray

2009-05-16 Thread Daniel Diniz

Changes by Daniel Diniz aja...@gmail.com:


--
stage:  - test needed
versions: +Python 3.2 -Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3489
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3489] add rotate{left,right} methods to bytearray

2009-05-16 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Am -1 on this.  Rotating byte arrays has very few use cases and the ones
it does have can typically be met by indexing.

--
nosy: +rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3489
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3489] add rotate{left,right} methods to bytearray

2008-08-08 Thread Josiah Carlson

Josiah Carlson [EMAIL PROTECTED] added the comment:

Sadly, this isn't quite as easy as it would seem.  The O(1) memory
overhead version of this requires 2n reads and 2n writes, but does both
reads and writes at two memory locations at a time, which may have
nontrivial performance implications.

The simple version that copies out the small part of the shift into a
temporary buffer, doing a memcpy/memmov internally, then copying the
small data back is likely to have much better performance (worst-case
1.5n reads and 1.5n writes.

Offering this ability in the momoryview object would be very
interesting, though I'm not sure that the memoryview object is able to
offer a multi-segment buffer interface where the segments are not the
same length (this could be hacked by having a single pointer per byte,
but at that point we may as well perform a copy).

--
nosy: +josiahcarlson

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3489
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3489] add rotate{left,right} methods to bytearray

2008-08-08 Thread Antoine Pitrou

Antoine Pitrou [EMAIL PROTECTED] added the comment:

Hi,

 Sadly, this isn't quite as easy as it would seem.

You are right, I was overly optimist when thinking about this.

 Offering this ability in the momoryview object would be very
 interesting, though I'm not sure that the memoryview object is able to
 offer a multi-segment buffer interface where the segments are not the
 same length (this could be hacked by having a single pointer per byte,
 but at that point we may as well perform a copy).

I'm not sure what you mean, but I think we can just restrict it to the
simple case of a single contiguous buffer.

shift{left,right} could be useful too (and faster).

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3489
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3489] add rotate{left,right} methods to bytearray

2008-08-08 Thread Josiah Carlson

Josiah Carlson [EMAIL PROTECTED] added the comment:

In order for MemoryView to know what bytes it is pointing to in memory,
it (generally) keeps a pointer with a length.  In order to rotate the
data without any copies, you need a pointer and length for each rotation
plus the original.  For example, the equivalent to a rotate left of 8
characters using slicing is... x[8:] + x[:8].  That is two segments. 
That's a multi-segment buffer interface.  But typical multi-segment
buffer interfaces require each segment to be exactly the same length
(like numpy), which is not the case with rotations.

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3489
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3489] add rotate{left,right} methods to bytearray

2008-08-08 Thread Antoine Pitrou

Antoine Pitrou [EMAIL PROTECTED] added the comment:

Le vendredi 08 août 2008 à 21:44 +, Josiah Carlson a écrit :
 Josiah Carlson [EMAIL PROTECTED] added the comment:
 
 In order for MemoryView to know what bytes it is pointing to in memory,
 it (generally) keeps a pointer with a length.  In order to rotate the
 data without any copies, you need a pointer and length for each rotation
 plus the original.  For example, the equivalent to a rotate left of 8
 characters using slicing is... x[8:] + x[:8].

Hmm, I think it's simpler if the rotate is done in-place rather than
returning a new object. Most uses of memoryviews are going to be with
APIs requiring a single contiguous segment.
(of course for read-only buffers it would raise an error)

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3489
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3489] add rotate{left,right} methods to bytearray

2008-08-01 Thread Antoine Pitrou

New submission from Antoine Pitrou [EMAIL PROTECTED]:

While tweaking the BufferedWriter implementation it came to me that it
would be useful to have rotate_left and rotate_right methods on
bytearray,  so as to rotate the array by a number of bytes without any
wasteful memory allocations and copies.

(or, if memoryview is one day implemented it could be a memoryview
method instead...)

--
components: Interpreter Core
messages: 70579
nosy: pitrou
priority: normal
severity: normal
status: open
title: add rotate{left,right} methods to bytearray
type: feature request
versions: Python 2.7, Python 3.1

___
Python tracker [EMAIL PROTECTED]
http://bugs.python.org/issue3489
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com