Greg Ewing wrote:
Some way of explicitly requesting a view into another
string might be desirable, but it shouldn't be the
default behaviour for string slicing.
Backporting 3.0's memoryview to 2.6 would be the way to go about that.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] |
Hi!
A thread in PyAr raised the question that, considering that strings
are immutable, why a slice of a string is a copy and not a reference
to a part of that string.
I couldn't answer why, so I'm asking here...Is it because the
reference counting will be complicated? Is it because it'd be
On Thu, May 22, 2008 at 12:28:47PM -0300, Facundo Batista wrote:
considering that strings
are immutable, why a slice of a string is a copy and not a reference
to a part of that string.
I remember some discussions... let me see... google to help... aha:
Facundo Batista wrote:
Hi!
A thread in PyAr raised the question that, considering that strings
are immutable, why a slice of a string is a copy and not a reference
to a part of that string.
I couldn't answer why, so I'm asking here...Is it because the
reference counting will be complicated? Is
Facundo Batista wrote:
I couldn't answer why, so I'm asking here...Is it because the
reference counting will be complicated? Is it because it'd be
inefficient in other way? It's something else? Or is something that
could be done... but is not done yet?
If we changed Python to
2008/5/22 Oleg Broytmann [EMAIL PROTECTED]:
I remember some discussions... let me see... google to help... aha:
http://mail.python.org/pipermail/python-3000/2006-August/003224.html
http://mail.python.org/pipermail/python-3000/2006-August/003242.html
These descussions are too general, and
2008/5/22 Isaac Morland [EMAIL PROTECTED]:
By contrast, the worst that can happen with no sharing is that performance
and memory use is what you expect - the only bad is the apparent missed
opportunity for optimization.
Exactly, apparent.
Also, this could be handled like a good writing tip.
On Thu, May 22, 2008, Facundo Batista wrote:
A thread in PyAr raised the question that, considering that strings
are immutable, why a slice of a string is a copy and not a reference
to a part of that string.
Someone did a patch for this at one point, but I don't remember what
happened.
--
Facundo Batista schrieb:
Hi!
A thread in PyAr raised the question that, considering that strings
are immutable, why a slice of a string is a copy and not a reference
to a part of that string.
Because the reference approach is more complicated, harder to implement
and may lead to unexpected
On Thu, May 22, 2008 at 10:01 AM, Aahz [EMAIL PROTECTED] wrote:
On Thu, May 22, 2008, Facundo Batista wrote:
A thread in PyAr raised the question that, considering that strings
are immutable, why a slice of a string is a copy and not a reference
to a part of that string.
Someone did a patch
On Thu, 22 May 2008, Christian Heimes wrote:
The buffer interface was designed for the slice-as-copy use case:
a = abcdefg
b = buffer(a, 2, 3)
b
read-only buffer for 0x839c2e0, size 3, offset 2 at 0x8391c40
str(b)
'cde'
[]
This answers my musing about shared slices. But it points me
Isaac Morland wrote:
On Thu, 22 May 2008, Christian Heimes wrote:
The buffer interface was designed for the slice-as-copy use case:
a = abcdefg
b = buffer(a, 2, 3)
b
read-only buffer for 0x839c2e0, size 3, offset 2 at 0x8391c40
str(b)
'cde'
[]
This answers my musing about shared
Stefan Behnel schrieb:
Even worse, it's gone in Py3:
No, it has been replaced by a better system.
Try memoryview
Christian
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
Hi,
Christian Heimes wrote:
Stefan Behnel wrote:
Even worse, it's gone in Py3:
No, it has been replaced by a better system.
Try memoryview
I know. We are already discussing the buffer protocol on the Cython list.
I couldn't answer why, so I'm asking here...Is it because the
reference counting will be complicated? Is it because it'd be
inefficient in other way? It's something else? Or is something that
could be done... but is not done yet?
There are two problems with that approach:
a) you may hold
Facundo Batista wrote:
A thread in PyAr raised the question that, considering that strings
are immutable, why a slice of a string is a copy and not a reference
to a part of that string.
Because it would make it too easy to accidentally keep
a large string alive via a reference to a small part
2008/5/22 Facundo Batista [EMAIL PROTECTED]:
I couldn't answer why, so I'm asking here...Is it because the
reference counting will be complicated? Is it because it'd be
inefficient in other way? It's something else? Or is something that
could be done... but is not done yet?
Thank you all for
17 matches
Mail list logo