"William Stein" <[EMAIL PROTECTED]> writes:

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

I probably should have asked: why doesn't R after

  sage: R=Set(range(0,20,2))

have a parent method?  I thought that parent is defined by Sage...  Maybe
differently put: why is the result of Set fundamentally different from, say,
the result of vector?  (I'm trying to say: "fundamentally different" with
respect to their properties as Python objects)  One difference I can see is
that vector returns a type, and Set a class, but I couldn't find a definitive
answer on the web.

http://www.python.org/download/releases/2.2.3/descrintro/

says:

Python 2.2 introduces the first phase of "type/class unification". This is a
series of changes to Python intended to remove most of the differences between
built-in types and user-defined classes.

but I guess I'm misunderstanding something here, since
sage.modules.vector_integer_dense.Vector_integer_dense is certainly not
built-in...

sage: type(vector([1,2,3]))
<type 'sage.modules.vector_integer_dense.Vector_integer_dense'>
sage: type(Set([1,2,3]))
<class 'sage.sets.set.Set_object_enumerated'>

Please help!

Not sure, whether it's a similar question: why doesn't Primes() export
intersect, union, etc.  Is this a design decision, a language problem, or just
because it's not yet implemented?

> > seems that it's not a language thing, because they often return
> > different things.
> 
> It is a language thing, I think.

It would be great if you could give me a hint.

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

I could not find an answer to that question in "Dive into Python", not in the
python reference.  Are you saying that Integer Ring cannot implement a Mod
method, or that it should not?

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

Well, looking at this book, I got the impression that the answer to my question
is "yes, it's the methods responsibility and no, there is no other
possibility".  I was hoping for a different answer, but if it's that way,
that's OK, too.

I'm very sorry if my questions are stupid, but it's really hard for me to grasp
the way things work in Sage and Python.  Until recently I thought that FriCAS
and Sage would be relatively similar, it seems to me now that they are
extremely different.  I hope I'm only having beginner's troubles.

Hoping for your patience,

Martin


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