Hi,

On 2013-02-17, Simon King <[email protected]> wrote:
> UniqueRepresentation is not just about "caching of an object by means of the
> arguments used to create it"! In addition, it is about objects that compare
> equal if and only if they are identical. Hence, overriding __eq__ simply
> makes no sense for sub-classes of UniqueRepresentation.
>
> What shall we do about it?

What about separating the two features? For example:

- have a new class CachedRepresentation, that uses a __classcall__ with a
  @weak_cached_function decorator and provides pickling, but does not provide
  __hash__ or __eq__. Hence, objects with different representations could
  still be equal.

- have UniqueRepresentation, that inherits from CachedRepresentation and
  *forces* the use of very fast __hash__ and comparison methods relying on
  id. The hash and comparison could not be overridden in sub-classes.

So, named groups could inherit from CachedRepresentation, and the use of
UniqueRepresentation could be reserved to those things that are supposed
to provide the unique parent condition (which is not the case for named
groups).

Cheers,
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to