Brian Harring schrieb:
>> I think this is incorrect. The implementation could well support it,
>> putting a dummy object into the deleted key (which deletion needs
>> to do, anyway).
>
> The implementation already uses a sentinel (NULL)-
That' not the full truth. The implementation has a separate
On Mon, Dec 04, 2006 at 07:15:35PM +0100, "Martin v. L??wis" wrote:
> Brian Harring schrieb:
> > For dict; it actually *cannot* work. You can't remove keys from a
> > dict as you're iterating over it (can change the val of a key, but not
> > remove the key).
>
> I think this is incorrect. The i
Ben Wing schrieb:
> i do see your point. i was trying to remember what i ended up doing
> when i ran into this issue before, and in fact i ended up just making a
> new list and appending all the elements i didn't want to delete. i see
> you'd get N^2 behavior if you deleted lots of elements fr
Brian Harring schrieb:
> For dict; it actually *cannot* work. You can't remove keys from a
> dict as you're iterating over it (can change the val of a key, but not
> remove the key).
I think this is incorrect. The implementation could well support it,
putting a dummy object into the deleted key
Brian Harring wrote:
> On Sun, Dec 03, 2006 at 08:35:58PM -0600, Ben Wing wrote:
>
>> but i still don't see why supporting iter.delete() is so wrong. clearly
>> it doesn't need to work on files or other such things where it doesn't
>> make sense.
>>
>> before you diss this completely, note
On Sun, Dec 03, 2006 at 08:35:58PM -0600, Ben Wing wrote:
> but i still don't see why supporting iter.delete() is so wrong. clearly
> it doesn't need to work on files or other such things where it doesn't
> make sense.
>
> before you diss this completely, note that java supports exactly the
> s
Brian Harring wrote:
> On Sun, Dec 03, 2006 at 06:24:17AM -0600, Ben Wing wrote:
>
>> many times writing somewhat complex loops over lists i've found the need
>> to sometimes delete an item from the list. currently there's no easy
>> way to do so; basically, you have to write something like
>
On 12/3/06, Ben Wing <[EMAIL PROTECTED]> wrote:
> many times writing somewhat complex loops over lists i've found the need
> to sometimes delete an item from the list. currently there's no easy
> way to do so; basically, you have to write something like
As I don't believe there's any need for a l
Ben Wing schrieb:
> i'd much rather see something like:
>
> for x:iter in list:
> ...do something...
> if x should be deleted:
> iter.delete()
You can easily implement that feature yourself if you need it,
at least for lists (or sequences that support integer indexing):
class deletable_i
On Sun, Dec 03, 2006 at 06:24:17AM -0600, Ben Wing wrote:
> many times writing somewhat complex loops over lists i've found the need
> to sometimes delete an item from the list. currently there's no easy
> way to do so; basically, you have to write something like
>
> i = 0
> while i < len(list):
many times writing somewhat complex loops over lists i've found the need
to sometimes delete an item from the list. currently there's no easy
way to do so; basically, you have to write something like
i = 0
while i < len(list):
el = list[i]
...do something...
if el should be deleted:
de
11 matches
Mail list logo