Pointers in Python

Anton Shishkov anton.shishkov at gmail.com
Tue Apr 27 09:09:50 EDT 2010


Hi, I can't figure out how can I change the variable type in function.
In C I could do that easily by changing pointer.

Code:
def add(b):

    b = {}
    print type(b)

a = []
print type(a)
add(a)
print type(a)

Output:
<type 'list'>
<type 'dict'>
<type 'list'>



More information about the Python-list mailing list