>> On 2013-02-09, Anne Schilling <an...@math.ucdavis.edu> wrote:
>> >> 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.
>>
>> I don't think so. A ValueError should be raised on wrong values of the
>> right type, and a TypeError should be raised on arguments of wrong type.
>> This is the case here, and this is also the case in many other
>> occasions, such as:
>>   sage: P.<x,y> = ZZ[]
>>   sage: P(1/2)
>>   Traceback (most recent call last):
>>   ...
>>   TypeError: Could not find a mapping of the passed element to this ring.
>>
>> So, no bug, but a behaviour that is consistent with the rest of Sage.
>>
>
> I misdescribed how I came across the error. It is:
>
> sage: 1 in Tableaux()
>
> Traceback (most recent call last)
> ...
> TypeError: 'sage.rings.integer.Integer' object is not iterable
>
> which I think is definitely a bug.

I agree that __contains__ should *never* raise an error. On the other
hand, the implementation of __contains__ of Tableaux is not
satisfactory as it only uses the constructor to test whether the input
is valid.
{{{
try:
   Tableau(elt)
except ValueError:
   return False
return True
}}}
Removing the method __contains__ would be similar if not better (the
default implementation of __contains__ in Parent is a bit safer).

Cheers,
Vincent

-- 
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