Variable definition

Dave Angel davea at
Sat Feb 27 05:56:20 CET 2010

Steven D'Aprano wrote:
> <snip>
> for key, value in varDic.iteritems():
>     varDic['myPrefix_' + key] = value
>     del varDic[key]
> <snip>
Watch out if any of the existing values already startswith 'myPrefix'  
You can end up with trouble just as confusing as if 'myPrefix' is an 
empty string


More information about the Python-list mailing list