On Tue, Feb 23, 2010 at 1:55 PM, Giorgio
> And, please let me ask a question: Kent told that nested_namespace(s) are
> default in python 2.6. And i found a line confirming this in py2.6 library.
> But, what about python 2.5 that as you know is the default on linux?
Yes, since 2.2 nested namespaces
Ok Hugo,
so, going back to your example:
def nochange(some_list):
# create shallow copy of list. NOTE: Shallow copies may still bite
you if you change the list members.
some_list = some_list[:]
some_list[1] = 2
Here we've created a new list. It's an object in the global "object-space
:)
On Tue, Feb 23, 2010 at 2:28 PM, Giorgio wrote:
> Thankyou Hugo!
> Ok, so i think the key is of my problem is that when doing X = 0 i'm
> creating a new object, that only exist in the local namespace. BUT, when
> using a list as a parameter for a function i'm only giving it a new name,
> but the o
Thankyou Hugo!
Ok, so i think the key is of my problem is that when doing X = 0 i'm
creating a new object, that only exist in the local namespace. BUT, when
using a list as a parameter for a function i'm only giving it a new name,
but the object it's referring to it's always the same, and is in th
On Tue, Feb 23, 2010 at 1:13 PM, Giorgio wrote:
> I have an update:
> I can easily undertand why this example doesn't work:
> def nochange(x):
> x = 0
> y = 1
> nochange(y)
> print y # Prints out 1
> X is a local variable, and only gets modified in the function, that doesn't
> return any value
Thankyou.
It's clear, this definitely helps me with the first question. But still
doesn't explain almost anything about the example i've posted in the last
post, right?
Giorgio
2010/2/23 Christian Witts
> Giorgio wrote:
>
>> I have an update:
>>
>> I can easily undertand why this example doesn
Giorgio wrote:
I have an update:
I can easily undertand why this example doesn't work:
def nochange(x):
x = 0
y = 1
nochange(y)
print y # Prints out 1
X is a local variable, and only gets modified in the function, that
doesn't return any value.
But it's very difficult for me to underst
I have an update:
I can easily undertand why this example doesn't work:
def nochange(x):
x = 0
y = 1
nochange(y)
print y # Prints out 1
X is a local variable, and only gets modified in the function, that doesn't
return any value.
But it's very difficult for me to understand WHY this works:
Ahah Kent this is amazing.
I was reading the ITALIAN
http://www.python.it/doc/articoli/instpy-0.html version
of that guide that is not updated. But, when i decided to post there i've
posted the link of the guide in english, but actually that's not what i've
readen.
Ok, so in the new python versio
On Mon, Feb 22, 2010 at 9:13 AM, Giorgio wrote:
> And, i have some difficulties understanding the other "strange" example in
> that howto. Just scroll down to: "However, the point is that the value
> of x is picked up from the environment at the time when the function is
> defined. How is this us
Ok, thankyou.
So, in other words, i must pay attention to what i set as default value in a
function. I should NEVER set empty lists as default values.
The guide i've linked says "To learn more about this, you should read the
documentation and look for the difference between *identity* and *equali
On Mon, 22 Feb 2010 03:00:32 am Giorgio wrote:
> Hi,
>
> do you know if there is a way so that i can get multiple values from
> a function?
>
> For example:
>
> def count(a,b):
> c = a + b
> d = a - b
>
> How can I return the value of C and D?
Return a tuple of c and d:
>>> def count(a, b):
...
Hi,
do you know if there is a way so that i can get multiple values from a
function?
For example:
def count(a,b):
c = a + b
d = a - b
How can I return the value of C and D?
Then, i have another question: i've read, some time ago, this guide
http://hetland.org/writing/instant-python.html, ski
13 matches
Mail list logo