def make(node): # takes some input
for reg_names in reg.names # dont worry about reg_names and reg.names
if reg.size > 0: #reg.size is an inbuilt function
found_dict = {} # first dictionary
found_dict['reg.name'] = 'reg.size' # i want to save the name of the register : size of the register in the format name : size
else:
not_found_dict = {}
not_found_dict['reg.name'] = 'reg.size' #again, i want to save the name of the register : size of the register in the format name : size
return found_dict, not_found_dict
でOKそれぞれを使用して、2つの辞書を返すので、私を伝えることができ.sizeは有効な構文ですか?私はその後、下記のようにfunction_twoにfunction_oneとnot_found_dictでfound_dictを使用したいは、別個の機能
:
def function_one(input): # should this input be the function 'make' as I only want found_dict?
for name, size in found_dict.items(): #just for the names in found_dict
name_pulled = found_dict['reg.name'] # save the names temporarily to name_pulled using the key reg.name of found_dict
final_names[] = final_names.append(name_pulled) #save names from name_pulled into the list final_names and append them through the for loop. will this work?
def function_two(input): # i need not_found_dict so what should this input be?
for name, size in not_found_dict.items(): #using the names in not_found_dict
discard_name_pulled = not_found_dict['reg.name'] # save the names temporarily to discard_name_pulled using on the 'reg.name' from not_found_dict which is essentially the key to the dict
not_used_names[] = not_used_names.append(discard_name_pulled) # in the same way in function_one, save the names to the list not_used_names and append them through the for loop. Will this construct work?
主な質問はデフにするために、であるが、私はfunction_oneで正しく入力found_dictどのように行う2つの辞書(found_dictとnot_found_dict)を返しますfunction_twoのnot_found_dict?
まあ、それは動作しますか?そうでない場合はどうなりますか? –
残念ながら私はintrepretorを持たない環境で作業しています。だから私は有効な構造が作られていることを確認する必要があります。私の最大の疑問は、def makeからfunction_oneへの戻り値(found_dict)と、def makeからの戻り値(not_found_dict)をfunction_twoに使う方法です。 – zubinp