On Sunday, 28 July 2013 19:56:02 UTC+2, Simon King wrote: > > Am Sonntag, 28. Juli 2013 14:23:39 UTC+2 schrieb Simon King: >> >> It turns out that a lot of stuff in sage.combinat breaks. Apparently >> some people really want that if C is a class then C(*args,**kwds) is not >> an instance of this class. >> > > Here is an example: > > sage: mu = PartitionTuple([3,2]) > sage: isinstance(mu, PartitionTuple) >
HI Simon, I wrote this and although I agree it is an abuse is it what I wanted and I think that, mathematically, it is the correct behaviour. The point is that a partition is a 1-tuple of partitions and hence a partition tuple. On the other hand, in most applications (in mathematics or in sage) you don't want to think of a partition as tuple of partitions. As such I think this is a mild abuse as the class s returning a closely related class. In terms of implementation, this was discussed a ittle on sage-combinat. The general feeling was that the implementation of PartitonTuple should not compromise the Partition class because partitions are in so many places. To avoid code duplication I would have liked to have both classes inherit from a common super class (but still with the behaviour above that you don't like), but the general feeling was that this was a bad idea. As it stands now,the Partition and PartitionTuple classes play very well together , I think. Even though PartitionTuple does not always return a PartitionTuple it behaves as if it does. In my own applications I *need* Partition and PartitionTuple to behave identically -- the methods that I use exist in both classes -- and the current code achieves this. To continue your example: sage: mu = PartitionTuple([3,2]) sage: mu in PartitionTuples() True I know your posts are more general than this one example, but hopefully having my (possibly misguided) rationale explained for this one example with help the discussion. If there are better ways to implement these classes I"d be very pleased to hear them, but I do want the behaviour above. Cheers, Andrew -- 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 sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/groups/opt_out.