मैं पायथन 3.5 में टाइप संकेत का उपयोग कर रहा हूं। मेरा एक सहकर्मी उपयोग करता है typing.Dict
:
import typing
def change_bandwidths(new_bandwidths: typing.Dict,
user_id: int,
user_name: str) -> bool:
print(new_bandwidths, user_id, user_name)
return False
def my_change_bandwidths(new_bandwidths: dict,
user_id: int,
user_name: str) ->bool:
print(new_bandwidths, user_id, user_name)
return True
def main():
my_id, my_name = 23, "Tiras"
simple_dict = {"Hello": "Moon"}
change_bandwidths(simple_dict, my_id, my_name)
new_dict = {"new": "energy source"}
my_change_bandwidths(new_dict, my_id, my_name)
if __name__ == "__main__":
main()
वे दोनों ही ठीक काम करते हैं, कोई फर्क नहीं दिखता।
मैंने typing
मॉड्यूल प्रलेखन पढ़ा है ।
बीच typing.Dict
या dict
जो एक मैं इस कार्यक्रम में इस्तेमाल करना चाहिए?