Hello,

I have a class Diagram, which is a collection of objects and morphisms
(arrows) between them.  Another class, Category, should contain a
collection of diagrams which are known to possess a certain property.
Obviously, I don't want repetitions in this collection, so I am
considering choosing between Python's built-in sets and
sympy.core.sets.FiniteSet.  Which one would be the recommended way?

I reason in the following way.  From what I can see in the
implementation of FiniteSet, it is based on Python's built-in sets and
it adds proper interaction with other kinds of sets implemented in
SymPy (like Interval, Union, etc.).  Since I don't really need that
functionality, my choice should be Python's built-in sets.  Is this
right?

An one more on-topic question.  Diagram will contain at least one
collection of morphisms which I expect to implement using one of the
set container types I mentioned above (because, apparently, I don't
want duplicate morphisms).  To be able to store Diagram in sets, I'll
have to make it hashable.  Python's built-in set is unhashable, while
FiniteSet is, but I think it's Basic's __hash__ that gets called.  So,
is it OK if I rely on Basic to do the hashing, or should I write the
hash function myself?  If I should write it myself, is there a
recommended, SymPy-specific way to achieve that?

Sergiu

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to