by reference

Martin P. Hellwig mhellwig at xs4all.nl
Mon Feb 13 05:10:57 EST 2006


dirvine wrote:
> Yes I did
> 
> I was trying to do something like (pseudo code)
> 
> write:
> get files in path
> for each filename get size, type
> create dic called filename assign size:xx,type:y
> pickle to file
> 
> read:
> open pickled file
> read dict name and contents (hoping unpickling file gives me the dict
> name as it was saved, which may not be true)
> do stuff with file
> 
> 
> and thats it. My prog is a bit more complex than this but this is the
> general idea basically read files -> create dicts of files one at a
> time, very similar to bittorrent in that take a file smash to bits and
> store links to bits in a big file.
> 
> Many thanls
> David
> 

Well, although I still think you should use nested dicts doesn't say 
that what you want isn't possible, take a look at this snippet:
 >>> locals()['test']=dict()
 >>> test
{}
 >>>
It looks quite ugly too me but that is probably in the eye of the 
beholder. However even the faq has some info on that:
http://www.python.org/doc/faq/programming.html#how-do-i-use-strings-to-call-functions-methods

-- 
mph



More information about the Python-list mailing list