Le mardi 13 mars 2012 à 14:57 +0100, Nicolas M. Thiery a écrit :
> On Tue, Mar 13, 2012 at 02:11:10PM +0100, Martin Rubey wrote:
> > "Nicolas M. Thiery" <[email protected]> writes:
> > In the code at hand I'd prefer to have the empty list. Currently I need
> > to have a case distinction...
> >
> > With keyword argument min_part, we also get the empty list, by the way.
>
> Thanks for the feedback. Any preference anyone?
Hello,
I do not have any preference but I really think that this question is
very important. Such corner case appears in all basic combinatoric
objects and it could be fine to fix a general rule for such cases,
especially since we intend to refactor basic some combinatorial objects
with Cython, ClonableIntArray, SetFactories and Selectors...
>From my point of view, the problem is the following :
You have a Constructor or SetFactory which have a lot of possible
arguments and your code have to dealt with combination of arguments that
make your set empty:
Exemple :
IntegerVectors(inner=[3,3,2], outer=[1,1,1])
Partitions(-1)
Combinations(min_part=3, max_part=2)
...
I could be fine to adopt the same behaviour every times :
(1) - I consider each argument as a mathematical condition thus if two
arguments make the set empty, it is the problem of the user and I return
the EmptySet (better than the empty list, doing the same than the empty
list but category compatible).
(2) - I need to inform the user that he is asking for a absurdity
because (3 <= size_part <= 2) ==> (3 <= 2) is a mathematical absurdity.
I return a ValueError.
(3) - Choosing (1) or (2) following the case.
*******************
Extra question : What should return
IntegerVectors(inner=[1,1,1], outer=[1,1]) ?
(1) An error ?
(2) An infinite set {[1,1,1], [1,1,2], [1,1,3], [1,1,4], ... }
I do not have a strong experience for the long run on that but I played
a lot with. It is not easy to choose a behaviour especially when one
doesn't know so much use cases.
Cheers,
Nicolas B.
--
You received this message because you are subscribed to the Google Groups
"sage-combinat-devel" 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/sage-combinat-devel?hl=en.