Paul Rubin於 2012年8月17日星期五UTC+8上午9時01分39秒寫道:
> Ian Kelly writes:
>
> > With regard to key insertion and deletion while iterating over a dict
>
> > or set, though, there is just no good reason to be doing that
>
> > (especially as the result is very implementation-specific), and I
>
> > wouldn't
On Thursday, August 23, 2012 1:11:14 PM UTC-5, Steven D'Aprano wrote:
> On Thu, 23 Aug 2012 09:49:41 -0700, Aaron Brady wrote:
>
>
>
> [...]
>
> > The patch for the above is only 40-60 lines. However it introduces two
>
> > new concepts.
>
> >
>
> > The first is a "linked list", a classic
On 08/09/2012 21:06, Thomas Rachel wrote:
Am 19.08.2012 00:14 schrieb MRAB:
Can someone who is more familiar with the cycle detector and cycle
breaker, help prove or disprove the above?
In simple terms, when you create an immutable object it can contain
only references to pre-existing objects
On 8/09/12 22:06:08, Thomas Rachel wrote:
> Am 19.08.2012 00:14 schrieb MRAB:
>
>>> Can someone who is more familiar with the cycle detector and cycle
>>> breaker, help prove or disprove the above?
>>>
>> In simple terms, when you create an immutable object it can contain
>> only references to pre
Am 19.08.2012 00:14 schrieb MRAB:
Can someone who is more familiar with the cycle detector and cycle
breaker, help prove or disprove the above?
In simple terms, when you create an immutable object it can contain
only references to pre-existing objects, but in order to create a cycle
you need t
On Monday, September 3, 2012 8:59:16 PM UTC-5, Steven D'Aprano wrote:
> On Mon, 03 Sep 2012 21:50:57 -0400, Dave Angel wrote:
>
>
>
> > On 09/03/2012 09:26 PM, Steven D'Aprano wrote:
>
>
>
> >> An unsigned C int can count up to 4,294,967,295. I propose that you say
>
> >> that is enough iter
On Mon, 03 Sep 2012 21:50:57 -0400, Dave Angel wrote:
> On 09/03/2012 09:26 PM, Steven D'Aprano wrote:
>> An unsigned C int can count up to 4,294,967,295. I propose that you say
>> that is enough iterators for anyone, and use a single, simple, version
>> counter in the dict and the iterator. If s
On 09/03/2012 09:26 PM, Steven D'Aprano wrote:
> On Mon, 03 Sep 2012 13:04:23 -0700, Aaron Brady wrote:
>
>>
>>
>> I think the technique would require two python longs and a bool in the
>> set, and a python long in the iterator.
>>
>> One long counts the number of existing (open) iterators. Anoth
On Mon, 03 Sep 2012 13:04:23 -0700, Aaron Brady wrote:
> On Monday, September 3, 2012 2:30:24 PM UTC-5, Ian wrote:
>> On Sun, Sep 2, 2012 at 11:43 AM, Aaron Brady
>> wrote:
>>
>> > We could use a Python long object for the version index to prevent
>> > overflow. Combined with P. Rubin's idea to
On Monday, September 3, 2012 3:28:28 PM UTC-5, Dave Angel wrote:
> On 09/03/2012 04:04 PM, Aaron Brady wrote:
>
> > On Monday, September 3, 2012 2:30:24 PM UTC-5, Ian wrote:
>
> >> On Sun, Sep 2, 2012 at 11:43 AM, Aaron Brady wrote:
>
> >>
>
> >>> We could use a Python long object for the vers
On 27.08.12 22:17, Ian Kelly wrote:
May I
suggest an alternate approach? Internally tag each set or dict with a
"version", which is just a C int. Every time the hash table is
modified, increment the version. When an iterator is created, store
the current version on the iterator. When the iter
On 09/03/2012 04:04 PM, Aaron Brady wrote:
> On Monday, September 3, 2012 2:30:24 PM UTC-5, Ian wrote:
>> On Sun, Sep 2, 2012 at 11:43 AM, Aaron Brady wrote:
>>
>>> We could use a Python long object for the version index to prevent
>>> overflow. Combined with P. Rubin's idea to count the number
On Monday, September 3, 2012 2:30:24 PM UTC-5, Ian wrote:
> On Sun, Sep 2, 2012 at 11:43 AM, Aaron Brady wrote:
>
> > We could use a Python long object for the version index to prevent
> > overflow. Combined with P. Rubin's idea to count the number of open
> > iterators, most use cases still w
On Sun, Sep 2, 2012 at 11:43 AM, Aaron Brady wrote:
> We could use a Python long object for the version index to prevent overflow.
> Combined with P. Rubin's idea to count the number of open iterators, most use
> cases still wouldn't exceed a single word comparison; we could reset the
> counte
On Monday, August 27, 2012 2:17:45 PM UTC-5, Ian wrote:
> On Thu, Aug 23, 2012 at 10:49 AM, Aaron Brady wrote:
>
> > The patch for the above is only 40-60 lines. However it introduces two new
> > concepts.
>
>
>
> Is there a link to the patch?
Please see below. It grew somewhat during deve
On Thu, Aug 23, 2012 at 10:49 AM, Aaron Brady wrote:
> The patch for the above is only 40-60 lines. However it introduces two new
> concepts.
Is there a link to the patch?
> The first is a "linked list", a classic dynamic data structure, first
> developed in 1955, cf. http://en.wikipedia.org/
On Thursday, August 23, 2012 1:11:14 PM UTC-5, Steven D'Aprano wrote:
> On Thu, 23 Aug 2012 09:49:41 -0700, Aaron Brady wrote:
>
>
>
> [...]
>
> > The patch for the above is only 40-60 lines. However it introduces two
>
> > new concepts.
>
> >
>
> > The first is a "linked list", a classic
On Thu, 23 Aug 2012 09:49:41 -0700, Aaron Brady wrote:
[...]
> The patch for the above is only 40-60 lines. However it introduces two
> new concepts.
>
> The first is a "linked list", a classic dynamic data structure, first
> developed in 1955, cf. http://en.wikipedia.org/wiki/Linked_list .
> L
On Saturday, August 18, 2012 9:28:32 PM UTC-5, Aaron Brady wrote:
> On Saturday, August 18, 2012 5:14:05 PM UTC-5, MRAB wrote:
>
> > On 18/08/2012 21:29, Aaron Brady wrote:
>
> > > On Friday, August 17, 2012 4:57:41 PM UTC-5, Chris Angelico wrote:
>
> > >> On Sat, Aug 18, 2012 at 4:37 AM, Aaron
On Saturday, August 18, 2012 5:14:05 PM UTC-5, MRAB wrote:
> On 18/08/2012 21:29, Aaron Brady wrote:
>
> > On Friday, August 17, 2012 4:57:41 PM UTC-5, Chris Angelico wrote:
>
> >> On Sat, Aug 18, 2012 at 4:37 AM, Aaron Brady wrote:
>
> >>
>
> >> > Is there a problem with hacking on the Beta?
On 18/08/2012 21:29, Aaron Brady wrote:
On Friday, August 17, 2012 4:57:41 PM UTC-5, Chris Angelico wrote:
On Sat, Aug 18, 2012 at 4:37 AM, Aaron Brady wrote:
> Is there a problem with hacking on the Beta?
Nope. Hack on the beta, then when the release arrives, rebase your
work onto it. I d
On Friday, August 17, 2012 4:57:41 PM UTC-5, Chris Angelico wrote:
> On Sat, Aug 18, 2012 at 4:37 AM, Aaron Brady wrote:
>
> > Is there a problem with hacking on the Beta?
>
>
>
> Nope. Hack on the beta, then when the release arrives, rebase your
>
> work onto it. I doubt that anything of thi
On Sat, Aug 18, 2012 at 4:37 AM, Aaron Brady wrote:
> Is there a problem with hacking on the Beta?
Nope. Hack on the beta, then when the release arrives, rebase your
work onto it. I doubt that anything of this nature will be changed
between now and then.
ChrisA
--
http://mail.python.org/mailman
On Thursday, August 16, 2012 9:24:44 PM UTC-5, Steven D'Aprano wrote:
> On Thu, 16 Aug 2012 19:11:19 -0400, Dave Angel wrote:
>
>
>
> > On 08/16/2012 05:26 PM, Paul Rubin wrote:
>
> >> Dave Angel writes:
>
> >>> Everything else is implementation defined. Why should an
>
> >>> implementation
On Thursday, August 16, 2012 9:30:42 PM UTC-5, Paul Rubin wrote:
> Steven D'Aprano writes:
>
> > Luckily, Python is open source. If anyone thinks that sets and dicts
>
> > should include more code protecting against mutation-during-iteration,
>
> > they are more than welcome to come up with a
On Thursday, August 16, 2012 8:01:39 PM UTC-5, Paul Rubin wrote:
> Ian Kelly writes:
>
> > With regard to key insertion and deletion while iterating over a dict
>
> > or set, though, there is just no good reason to be doing that
>
> > (especially as the result is very implementation-specific),
On Thursday, August 16, 2012 6:07:40 PM UTC-5, Ian wrote:
> On Thu, Aug 16, 2012 at 4:55 PM, Ian Kelly wrote:
>
> > On Thu, Aug 16, 2012 at 12:00 PM, Aaron Brady wrote:
>
> >> The inconsistency is, if we remove an element from a set and add another
> >> during iteration, the new element might
Am 17.08.2012 03:01, schrieb Paul Rubin:
Ian Kelly writes:
With regard to key insertion and deletion while iterating over a dict
or set, though, there is just no good reason to be doing that
(especially as the result is very implementation-specific), and I
wouldn't mind a more complete low-leve
Steven D'Aprano writes:
> Luckily, Python is open source. If anyone thinks that sets and dicts
> should include more code protecting against mutation-during-iteration,
> they are more than welcome to come up with a patch. Don't forget unit and
> regression tests, and also a set of timing result
On Thu, 16 Aug 2012 19:11:19 -0400, Dave Angel wrote:
> On 08/16/2012 05:26 PM, Paul Rubin wrote:
>> Dave Angel writes:
>>> Everything else is implementation defined. Why should an
>>> implementation be forced to have ANY extra data structure to detect a
>>> static bug in the caller's code?
>> F
Ian Kelly writes:
> With regard to key insertion and deletion while iterating over a dict
> or set, though, there is just no good reason to be doing that
> (especially as the result is very implementation-specific), and I
> wouldn't mind a more complete low-level check against it as long as
> it's
On Thu, Aug 16, 2012 at 5:11 PM, Dave Angel wrote:
> There's an enormous difference between type errors, which affect the low
> level dispatch, and checking for whether a dict has changed and may have
> invalidated the iterator. If we were really going to keep track of what
> iterators are tracki
On 08/16/2012 05:26 PM, Paul Rubin wrote:
> Dave Angel writes:
>> Everything else is implementation defined. Why should an implementation
>> be forced to have ANY extra data structure to detect a static bug in the
>> caller's code?
> For the same reason the interpreter checks for type errors at r
On Thu, Aug 16, 2012 at 4:55 PM, Ian Kelly wrote:
> On Thu, Aug 16, 2012 at 12:00 PM, Aaron Brady wrote:
>> The inconsistency is, if we remove an element from a set and add another
>> during iteration, the new element might appear later in the iteration, and
>> might not, depending on the hash
On Thu, Aug 16, 2012 at 12:00 PM, Aaron Brady wrote:
> The inconsistency is, if we remove an element from a set and add another
> during iteration, the new element might appear later in the iteration, and
> might not, depending on the hash code; therefore comparing the size of the
> set between
Dave Angel writes:
> Everything else is implementation defined. Why should an implementation
> be forced to have ANY extra data structure to detect a static bug in the
> caller's code?
For the same reason the interpreter checks for type errors at runtime
and raises TypeError, instead of letting
On 08/16/2012 02:00 PM, Aaron Brady wrote:
> Hello,
>
> I observed an inconsistency in the behavior of 'set' and 'dict' iterators.
> It is "by design" according to the docs.
>
> '''
> http://docs.python.org/dev/library/stdtypes.html#dict-views
>
> iter(dictview). Iterating views while adding or
Hello,
I observed an inconsistency in the behavior of 'set' and 'dict' iterators. It
is "by design" according to the docs.
'''
http://docs.python.org/dev/library/stdtypes.html#dict-views
iter(dictview). Iterating views while adding or deleting entries in the
dictionary may raise a RuntimeErr
38 matches
Mail list logo