On Dec 14, 2007 12:19 PM, mekaj <[EMAIL PROTECTED]> wrote:
> Now I would expect that when I call print_partitions(x), where 'x' is
> an Integer that SAGE would print all possible partitions of 'x'.  The
> first time I call the function it works as expected.  However, for
> each call after that, it seems to concatenate the results to the
> results of all the previous calls.

The issue is with Python's calling model which is, roughly speaking,
"call by object".  This kind of thing is possible:

def foo(y):
    y.append(0)

sage: mylist = []
sage: foo(mylist)
sage: foo(mylist)
sage: mylist
[0, 0]

Here's a bit of an explanation about Python's calling model:

http://effbot.org/zone/call-by-object.htm

So it's not exactly call by reference or call by value, but a bit of both.

-- 
Carlo Hamalainen
http://carlo-hamalainen.net

--~--~---------~--~----~------------~-------~--~----~
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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to