Mike Hansen wrote:
> On Mon, May 4, 2009 at 12:19 PM, Jaap Spies <j.sp...@hccnet.nl> wrote:
>> Another Python builtin is pow(), but how is it possible that
>> type(pow(2,9,11)) returns
>> <type 'sage.rings.integer_mod.IntegerMod_int'>
>>
>> Or am I mistaken?
> 
> The pow() builtin just calls __pow__ on the first argument in that
> case, which we control so we can return one of our types.  len() will
> call __len__, but forces whatever is returned to be an int.  This is
> what will be changing in Python 3.0.
> 

Than pow? gives a misleading text:

>> Type:        <type 'builtin_function_or_method'>
>> Definition:  pow( [noargspec] )
>> Docstring: 
>> pow(x, y[, z]) -> number
>> 
>> With two arguments, equivalent to x**y.  With three arguments,
>> equivalent to (x**y) % z, but may be more efficient (e.g. for longs).


type(pow(2,9)) returns
<type 'sage.rings.integer.Integer'>

type(pow(2,9) % 11) returns
<type 'sage.rings.integer.Integer'>

same for type(2^9 % 11) and type(2**9 % 11)


Jaap


> --Mike
> 
> > 
> 


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to