Hi Andrew,

> I came across this today:
> 
> sage: Partition(1)
> Traceback (most recent call last)
> ...
> TypeError: 'sage.rings.integer.Integer' object is not iterable
> sage: Tableau(1)
> Traceback (most recent call last)
> ...
> TypeError: 'sage.rings.integer.Integer' object is not iterable
> 
> Even though in both cases the input is clearly garbage, I think that this is 
> a bug because rather than failing ungracefully like this I think that a 
> ValueError should be raised with an error message
> identifying the garbage input. (For what it's worth, I came across this when 
> this error broke some of my code which was expecting a ValueError in such 
> situations. Of course, I could also trap a
> TypeError and maybe another 20 possibilities but it would be better if I knew 
> what error to expect.)
> 
> In both cases, the source of this problem iis that in 
> CombinatorialObject.__init__ we have
> 
>         if isinstance(l, list):
>             self._list = l
>         else:
>             self._list = list(l)
> 
> but it is never checked  that ``l`` can be turned into a list. On top of 
> this, Tableau(), Partition() -- and I suspect many others -- never check to 
> see if their calls to CombinatorialObject.__init__
> (and Element.__init__) actually work. If CombinatorialObject.__init__ raises 
> a ValueError I can live with the latter.
> 
> Please let me know if you think this is not a bug. If the consensus is that 
> this is a bug the I will open a ticket and post a patch sometime next week.

Yes, this looks like a bug.

Are you coming to the Sage Days at ICERM this coming week? Are you writing the 
e-mails from
the airplane?

Cheers,

Anne

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to