newbie questions

houbahop d.lapasset
Sat Dec 11 01:48:38 CET 2004


Hello everyone,
    I'm new to python dev, and there are some things I don't understand 
about arrays and subs

In my code, I have an array of strings (in the main function)

   self.SortiesAnimeTitreLabel = []

then I pass this array to a sub that fill it it ( using.append('blabla') :

   self.InstancierLabelsTitre(self.SortiesAnimeTitreLabel)

then, I need to reset this var, and this is my problem, I have created an 
other sub to reset and it doesn't seems to work, like if the parameter was 
pass by value instead of by reference. here is the sub :


def RAZVarAnimesDuJour(self,oSortiesAnimeTitreLabel):
           for i in xrange(len(oSortiesAnimeTitreLabel)):
               del oSortiesAnimeTitreLabel[i]

it doesn't emty my var (i don't want to destroy the var, just make it like 
if it just have been created

do yo have any idea of what is causing this problem?
is it possible to do self.SortiesAnimeTitreLabel = [] to reset the var? (it 
seems to work outside of the sub, but I believe that the var I'm erasing is 
not the one I want but a local copy.


Thank you for your help.
Dominique. 





More information about the Python-list mailing list