Hi Clemens,

On 2014-09-20, Clemens Heuberger <[email protected]> wrote:
> Shall I enforce that the parent of all labels is the same (and warn the user 
> if
> this is not the case?). Probably, I'd also allow strings as an additional type
> because this should not lead to conflicts.

You could pre-process the input before passing it to the dict/set.
Hence, if the user inputs an element of Frac(QQ[x]), then you can
pre-process it by normalising it (i.e., make the denominator monic).

>> Note that Sage provides some specialised dictionaries where objects are
>> always compared by identity, but I guess this won't be useful in your
>> application.
>
> Where can I find those?

I was thinking of sage.structure.coerce_dict.MonoDict and
sage.structure.coerce_dict.TripleDict. Note that the former only accepts
a key that is a single weak-refable object, while TripleDict only
accepts *triples* of weak-refable objects. It acts as a weak key
dictionary, i.e., if you do not keep an external reference to your keys,
the stored items will automatically be deleted.

Probably it is not what you need, I reckon that pre-processing of user
input is the better option.

Best regards,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to