set.add() doesn't replace equal element
Ian Pilcher
arequipeno at gmail.com
Sat Dec 31 11:41:32 EST 2022
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 would be unnecessary.
>
> I would:
>
> a) /not/ consider two different leases with two different time stamps to
> be equal, and
> b) as already mentioned, store them in another data structure like a
> dictionary.
>
> Not knowing the specifics of the DHCP object structure, if a DHCP lease
> object has some immutable key or other durable immutable attribute, I
> would be inclined to make that the dictionary key, and store the DHCP
> object as the value.
I have come to the conclusion that you are correct. Thanks!
--
========================================================================
Google Where SkyNet meets Idiocracy
========================================================================
More information about the Python-list
mailing list