On 12/30/22 17:00, Paul Bryan wrote:
It seems to me like you have to ideas of what "equal" means. You want to
update a "non-equal/equal" value in the set (because of a different time
stamp). If you truly considered them equal, the time stamp would be
irrelevant and updating the value in the set
It seems to me like you have to ideas of what "equal" means. You want
to update a "non-equal/equal" value in the set (because of a different
time stamp). If you truly considered them equal, the time stamp would
be irrelevant and updating the value in the set would be unnecessary.
I would:
a)
On Sat, 31 Dec 2022 at 09:29, Ian Pilcher wrote:
>
> On 12/30/22 15:47, Paul Bryan wrote:
> > What kind of elements are being added to the set? Can you show
> > reproducible sample code?
>
> The objects in question are DHCP leases. I consider them "equal" if
> the lease address (or IPv6 prefix) i
On 12/30/22 15:47, Paul Bryan wrote:
What kind of elements are being added to the set? Can you show
reproducible sample code?
The objects in question are DHCP leases. I consider them "equal" if
the lease address (or IPv6 prefix) is equal, even if the timestamps have
changed. That code is not
in use, and
replacing it with the latest if needed.
Avi
-Original Message-
From: Python-list On
Behalf Of Ian Pilcher
Sent: Friday, December 30, 2022 4:41 PM
To: python-list@python.org
Subject: set.add() doesn't replace equal element
I just discovered this behavior, which is proble
On Sat, 31 Dec 2022 at 08:42, Ian Pilcher wrote:
>
> I just discovered this behavior, which is problematic for my particular
> use. Is there a different set API (or operator) that can be used to
> add an element to a set, and replace any equal element?
>
> If not, am I correct that I should call
What kind of elements are being added to the set? Can you show
reproducible sample code?
On Fri, Dec 30 2022 at 03:41:19 PM -0600, Ian Pilcher
wrote:
I just discovered this behavior, which is problematic for my
particular
use. Is there a different set API (or operator) that can be used to
a
I just discovered this behavior, which is problematic for my particular
use. Is there a different set API (or operator) that can be used to
add an element to a set, and replace any equal element?
If not, am I correct that I should call set.discard() before calling
set.add() to achieve the behavi