Help with sets
Terry Reedy
tjreedy at udel.edu
Tue Oct 5 16:45:40 EDT 2010
On 10/5/2010 3:01 AM, Ian Kelly wrote:
> self._pos = {predicate: {object: {subject: None}}}
>
> That's a bit ugly because the None serves no purpose here; the value
> associated with the subject has no meaning in this context.
This is what we did in Python before sets were added.
> It also
> uselessly takes up space in memory that could add up to significant
> wastage if the data structure grows to be large.
>
> The other major difference between dicts and sets is that sets provide
> mathematical operations such as intersection and difference that dicts
> do not, but that doesn't appear to be relevant in this context.
These two reasons are why we added sets.
--
Terry Jan Reedy
More information about the Python-list
mailing list