特に角かっこを避けるために、コードを簡素化したい。だから私の質問は:
def someFunction():
someString = "Hi!"
someNumber = 22
somePointer = ""
someList = []
names_list = ['someString','someNumber','somePointer','someList']
val_list = [someString, someNumber, somePointer, someList]
someDict = {}
for i in range( len( names_list ) ) :
someDict[names_list[i]] = val_list[i]
someOtherFunction( someDict )
def someOtherFunction( dict ):
for key, value in dict.iteritems() :
print key, value
print someString, someNumber
someFunction()
このように作ることは可能ですか?