On Saturday, April 18, 2015 at 7:36:36 PM UTC-4, Darij Grinberg wrote:
>
> OK, so this is wrong?
>
> sage: u = StandardTableau( [[1,2],[3,4],[5]] 
> ).standard_number_of_descents()
> sage: parent(u)
> <type 'int'>
>
> sage: u = Partition([3,2]).length()
> sage: parent(u)
> <type 'int'>
>
> sage: u = Partition([3,2]).frobenius_rank()
> sage: parent(u)
> <type 'int'>
>
> sage: u = SetPartition([[1], [2,3], [4]]).base_set_cardinality()
> sage: parent(u)
> <type 'int'>
>

Yes, imho those are all bugs. The only place where Sage should return int 
is in Python magic methods, e.g. __len__ 

 

> I fear this kind of stuff exists throughout sage-combinat... and I have 
> never encountered it causing problems.
>

x.cardinality().factor() should always work (unless it is inifinite).



A kind of corner case is if your code just works by duck-typing without 
>> ever needing a literal number. Then you should probably rely on coercion to 
>> do the right thing, so the output type matches the input type. 
>>
>
> This I don't understand...
>

def add_two_numbers(x,y):
    return x+y   # no need to convert explicitly to ZZ 

-- 
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/d/optout.

Reply via email to