The output of the magic __len__ method must be a (non-long) int in CPython. 
So > 64-bit integers are not supported.

On the commandline we should probably overwrite len with a version that 
looks at cardinality() first....



On Tuesday, April 14, 2015 at 11:45:14 AM UTC+2, Jori Mantysalo wrote:
>
> Just wondering, so feel free to ignore. 
>
> I noticed that MatrixSpace(GF(3), 4, 5).cardinality() raises an exception. 
> However, there is __len__: 
>
> sage: MatrixSpace(GF(3), 4, 5).__len__() 
> 3486784401 
> sage: len(MatrixSpace(GF(3), 4, 5)) 
> 3486784401 
>
> but 
>
> sage: MatrixSpace(GF(2003), 4, 5).__len__() 
> 1080485606479352381688319506340455348506693332851960692625585464401L 
> sage: len(MatrixSpace(GF(2003), 4, 5)) 
>   . . . OverflowError: long int too large to convert to int 
>
> I don't get this. Is `len` somehow internally redefined in Sage? Where? 
> What is the meaning of len and __len__? Should there be .cardinality() in 
> all Sage objects where it has some meaning? 
>
> -- 
> Jori Mäntysalo, 
> Maybe returned to 4-year old and got questioning-age again. 
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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