On Tue, Oct 14, 2008 at 4:15 AM, Martin <[EMAIL PROTECTED]> wrote:
>
> Am I doing something wrong in the session below?

I guess so, given the error messages.

> I admit that I do not understand python types and methods yet.  When
> can I apply the functional notation, when the method notation?  It

It's not just notation.  Python supports both functions and methods,
and they are just completely different things.

> seems that it's not a language thing, because they often return

It is a language thing, I think.

> different things.  As another example, Mod(5,3) and mod(5,3) seem to
> agree, while 5.mod(3) is different and 5.Mod(3) is an error.
>
> Is a method responsible for checking whether it's arguments are ofthe
> right type/parent, or  is there a possibility to restrict the
> arguments to a given type/parent?

You should really read the free book "Dive into Python". It's great (and free).

>
> Martin
>
> sage: reset()
> sage: R=Set(range(0,20,2))
> sage: R
> {0, 2, 4, 6, 8, 10, 12, 14, 16, 18}
> sage: R.type()
> ---------------------------------------------------------------------------
> AttributeError                            Traceback (most recent call
> last)
>
> /home/rubey/<ipython console> in <module>()
>
> AttributeError: 'Set_object_enumerated' object has no attribute 'type'
> sage: R.parent()
> ---------------------------------------------------------------------------
> AttributeError                            Traceback (most recent call
> last)
>
> /home/rubey/<ipython console> in <module>()
>
> AttributeError: 'Set_object_enumerated' object has no attribute
> 'parent'
> sage: type(R)
> <class 'sage.sets.set.Set_object_enumerated'>
> sage: parent(R)
> <class 'sage.sets.set.Set_object_enumerated'>
>
> >
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

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

Reply via email to