Antoine Pitrou solip...@pitrou.net wrote:
Only if the original object is itself mutable, otherwise the memoryview
is read-only.
I would propose the following algorithm:
1) try to calculate the original object's hash; if it fails, consider
the memoryview unhashable (the buffer is probably
On Sun, Nov 13, 2011 at 8:39 PM, Stefan Krah ste...@bytereef.org wrote:
Antoine Pitrou solip...@pitrou.net wrote:
Only if the original object is itself mutable, otherwise the memoryview
is read-only.
I would propose the following algorithm:
1) try to calculate the original object's hash; if
On Sun, Nov 13, 2011 at 8:49 PM, Antoine Pitrou solip...@pitrou.net wrote:
I don't understand this feature. How do you represent a reversed buffer
using the buffer API, and how do you ensure that consumers (especially
those written in C) see the buffer reversed?
The values in the strides array
Antoine Pitrou solip...@pitrou.net wrote:
I would propose the following algorithm:
1) try to calculate the original object's hash; if it fails, consider
the memoryview unhashable (the buffer is probably mutable)
With slices or the new casts (See: http://bugs.python.org/issue5231,
Nick Coghlan ncogh...@gmail.com wrote:
With slices or the new casts (See: http://bugs.python.org/issue5231,
implemented in http://hg.python.org/features/pep-3118#memoryview ),
it is possible to have different hashes for equal objects:
Note that Antoine isn't suggesting that the underlying
On Sun, 13 Nov 2011 13:05:24 +0100
Stefan Krah ste...@bytereef.org wrote:
Nick Coghlan ncogh...@gmail.com wrote:
With slices or the new casts (See: http://bugs.python.org/issue5231,
implemented in http://hg.python.org/features/pep-3118#memoryview ),
it is possible to have different
Stefan Krah, 13.11.2011 13:05:
Nick Coghlan wrote:
With slices or the new casts (See: http://bugs.python.org/issue5231,
implemented in http://hg.python.org/features/pep-3118#memoryview ),
it is possible to have different hashes for equal objects:
Note that Antoine isn't suggesting that the
Antoine Pitrou solip...@pitrou.net wrote:
Stefan Krah ste...@bytereef.org wrote:
I think they necessarily have to use the same hash, since:
exporter = m1 == hash(exporter) = hash(m1)
m1 = m2 == hash(m1) = hash(m2)
Am I missing something?
The hash must simply be calculated using
You can't expect the memoryview() to magically know what the underlying
hash function is.
Hashable objects implementing the buffer interface could be required to
make their hash implementation consistent with bytes hashing. IMO, that
wouldn't be asking too much.
There is already the issue
Hello everyone and Benjamin,
Currently, memoryview objects are unhashable:
hash(memoryview(b))
Traceback (most recent call last):
File stdin, line 1, in module
TypeError: unhashable type: 'memoryview'
Compare with Python 2.7:
hash(buffer())
0
memoryviews already support equality
Aren't memoryview objects mutable? I think that the underlying memory
can change, so it shouldn't be hashable.
On Sat, Nov 12, 2011 at 4:23 PM, Antoine Pitrou solip...@pitrou.net wrote:
Hello everyone and Benjamin,
Currently, memoryview objects are unhashable:
hash(memoryview(b))
Traceback
On Sat, 12 Nov 2011 17:15:08 -0800
Guido van Rossum gu...@python.org wrote:
Aren't memoryview objects mutable? I think that the underlying memory
can change, so it shouldn't be hashable.
Only if the original object is itself mutable, otherwise the memoryview
is read-only.
I would propose the
On Sun, Nov 13, 2011 at 11:19 AM, Antoine Pitrou solip...@pitrou.net wrote:
On Sat, 12 Nov 2011 17:15:08 -0800
Guido van Rossum gu...@python.org wrote:
Aren't memoryview objects mutable? I think that the underlying memory
can change, so it shouldn't be hashable.
Only if the original object
Thinking of it, an alternative would be to implement lazy slices of
bytes objects (Twisted uses buffer() for zero-copy slices).
Regards
Antoine.
On Sun, 13 Nov 2011 01:23:59 +0100
Antoine Pitrou solip...@pitrou.net wrote:
Hello everyone and Benjamin,
Currently, memoryview objects are
On Sat, Nov 12, 2011 at 5:40 PM, Nick Coghlan ncogh...@gmail.com wrote:
On Sun, Nov 13, 2011 at 11:19 AM, Antoine Pitrou solip...@pitrou.net wrote:
On Sat, 12 Nov 2011 17:15:08 -0800
Guido van Rossum gu...@python.org wrote:
Aren't memoryview objects mutable? I think that the underlying memory
15 matches
Mail list logo