Re: set.add() doesn't replace equal element

2022-12-31 Thread Ian Pilcher
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

Re: set.add() doesn't replace equal element

2022-12-30 Thread Paul Bryan
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)

Re: set.add() doesn't replace equal element

2022-12-30 Thread Chris Angelico
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

Re: set.add() doesn't replace equal element

2022-12-30 Thread Ian Pilcher
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

RE: set.add() doesn't replace equal element

2022-12-30 Thread avi.e.gross
Ian, Do you have some examples of things you can put in a set that you consider equal but want to store in the set INSTEAD of any current element? What follows is some thoughts on some methods you could build yourself. Others re possible and someone else may present you with a module that does wh

Re: set.add() doesn't replace equal element

2022-12-30 Thread Chris Angelico
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

Re: set.add() doesn't replace equal element

2022-12-30 Thread Paul Bryan
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