From 06b42385733991a6e169d5f240de035af515b736 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Mon, 23 Jun 2025 22:47:45 -0400 Subject: [PATCH 01/57] Create ->-in-function-definitions Code samples for -> type hints --- ->-in-function-definitions | 1 + 1 file changed, 1 insertion(+) create mode 100644 ->-in-function-definitions diff --git a/->-in-function-definitions b/->-in-function-definitions new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/->-in-function-definitions @@ -0,0 +1 @@ + From 4f7e271ac1db1b325d2b176161af81084a34f0d1 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Tue, 24 Jun 2025 09:34:56 -0400 Subject: [PATCH 02/57] Create simple_type_hint_example.py --- type_hint_arrow_samples/simple_type_hint_example.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 type_hint_arrow_samples/simple_type_hint_example.py diff --git a/type_hint_arrow_samples/simple_type_hint_example.py b/type_hint_arrow_samples/simple_type_hint_example.py new file mode 100644 index 0000000000..962e45a957 --- /dev/null +++ b/type_hint_arrow_samples/simple_type_hint_example.py @@ -0,0 +1,5 @@ +def get_number_of_titles(list) -> int: + return len(list) + +game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] +print(f"Number of titles: {get_number_of_titles(game_titles_list)}") From def2f9eff54aaa896133a4b9a5b022c4aa0b8017 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Tue, 24 Jun 2025 09:35:44 -0400 Subject: [PATCH 03/57] Add files via upload --- .../dictionary_return_type_example.py | 20 +++++++++++++++++++ .../dynamic_variable_example.py | 2 ++ type_hint_arrow_samples/game_class_example.py | 14 +++++++++++++ .../mismatched_return_type_example.py | 5 +++++ .../none_return_type_hint_example.py | 8 ++++++++ .../str_return_type_hint_example.py | 5 +++++ 6 files changed, 54 insertions(+) create mode 100644 type_hint_arrow_samples/dictionary_return_type_example.py create mode 100644 type_hint_arrow_samples/dynamic_variable_example.py create mode 100644 type_hint_arrow_samples/game_class_example.py create mode 100644 type_hint_arrow_samples/mismatched_return_type_example.py create mode 100644 type_hint_arrow_samples/none_return_type_hint_example.py create mode 100644 type_hint_arrow_samples/str_return_type_hint_example.py diff --git a/type_hint_arrow_samples/dictionary_return_type_example.py b/type_hint_arrow_samples/dictionary_return_type_example.py new file mode 100644 index 0000000000..e30f9aed9e --- /dev/null +++ b/type_hint_arrow_samples/dictionary_return_type_example.py @@ -0,0 +1,20 @@ +game_stock = { + "Dragon Quest": 5, + "Final Fantasy": 1, + "Age of Empires": 5 +} + +def get_highest_stock_game() -> dict[str, int]: + stock_quantities = game_stock.values() + high = 0 + for quantity in stock_quantities: + if quantity > high: + high = quantity + game_results = {} + + for game in game_stock: + if game_stock[game] == high: + game_results[game] = high + return game_results + +print(f"Games with the highest stock: {get_highest_stock_game()}") \ No newline at end of file diff --git a/type_hint_arrow_samples/dynamic_variable_example.py b/type_hint_arrow_samples/dynamic_variable_example.py new file mode 100644 index 0000000000..bd61f79800 --- /dev/null +++ b/type_hint_arrow_samples/dynamic_variable_example.py @@ -0,0 +1,2 @@ +my_number = 32 +my_number = "32" \ No newline at end of file diff --git a/type_hint_arrow_samples/game_class_example.py b/type_hint_arrow_samples/game_class_example.py new file mode 100644 index 0000000000..457dcbbcd3 --- /dev/null +++ b/type_hint_arrow_samples/game_class_example.py @@ -0,0 +1,14 @@ +class Game: + def __init__(self, name, genre, price) -> None: + self.name = name + self.genre = genre + self.price = price + + def get_name(self) -> str: + return self.name + + def get_genre(self) -> str: + return self.genre + + def get_price(self) -> float: + return self.price \ No newline at end of file diff --git a/type_hint_arrow_samples/mismatched_return_type_example.py b/type_hint_arrow_samples/mismatched_return_type_example.py new file mode 100644 index 0000000000..2d3064c5e6 --- /dev/null +++ b/type_hint_arrow_samples/mismatched_return_type_example.py @@ -0,0 +1,5 @@ +def get_number_of_titles(list) -> str: + return len(list) + +game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] +print(f"Number of titles: {get_number_of_titles(game_titles_list)}") \ No newline at end of file diff --git a/type_hint_arrow_samples/none_return_type_hint_example.py b/type_hint_arrow_samples/none_return_type_hint_example.py new file mode 100644 index 0000000000..c901c5ea3f --- /dev/null +++ b/type_hint_arrow_samples/none_return_type_hint_example.py @@ -0,0 +1,8 @@ +def find_keyword_in_titles(list, keyword) -> None: + print(f"Titles that contain the keyword {keyword}") + for game_title in list: + if keyword in game_title: + print(f"{game_title}") + +game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] +find_keyword_in_titles(game_titles_list, "Final") \ No newline at end of file diff --git a/type_hint_arrow_samples/str_return_type_hint_example.py b/type_hint_arrow_samples/str_return_type_hint_example.py new file mode 100644 index 0000000000..1d6e542c7b --- /dev/null +++ b/type_hint_arrow_samples/str_return_type_hint_example.py @@ -0,0 +1,5 @@ +def get_game_recommendation(list) -> str: + return random.choice(list) + +game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] +print(f"Random recommendation: {get_game_recommendation(game_titles_list)}") From d5924a200dd4f50f4f0c24472b2fc55019b570b3 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Tue, 24 Jun 2025 10:01:22 -0400 Subject: [PATCH 04/57] Update str_return_type_hint_example.py Added a missing import statement --- type_hint_arrow_samples/str_return_type_hint_example.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/type_hint_arrow_samples/str_return_type_hint_example.py b/type_hint_arrow_samples/str_return_type_hint_example.py index 1d6e542c7b..9f3be46926 100644 --- a/type_hint_arrow_samples/str_return_type_hint_example.py +++ b/type_hint_arrow_samples/str_return_type_hint_example.py @@ -1,3 +1,5 @@ +import random + def get_game_recommendation(list) -> str: return random.choice(list) From 035ba13c823584a530da731f477e9472d0744e33 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Tue, 24 Jun 2025 10:08:36 -0400 Subject: [PATCH 05/57] Update str_return_type_hint_example.py From 726066f72e10252fe9a530894d6ba30e4fd80da1 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Tue, 24 Jun 2025 10:14:40 -0400 Subject: [PATCH 06/57] Update str_return_type_hint_example.py --- type_hint_arrow_samples/str_return_type_hint_example.py | 1 - 1 file changed, 1 deletion(-) diff --git a/type_hint_arrow_samples/str_return_type_hint_example.py b/type_hint_arrow_samples/str_return_type_hint_example.py index 9f3be46926..40245b8057 100644 --- a/type_hint_arrow_samples/str_return_type_hint_example.py +++ b/type_hint_arrow_samples/str_return_type_hint_example.py @@ -1,5 +1,4 @@ import random - def get_game_recommendation(list) -> str: return random.choice(list) From e05ec45be54114740998bde35e265e00b1e634a3 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Tue, 24 Jun 2025 10:18:45 -0400 Subject: [PATCH 07/57] Update str_return_type_hint_example.py --- type_hint_arrow_samples/str_return_type_hint_example.py | 1 + 1 file changed, 1 insertion(+) diff --git a/type_hint_arrow_samples/str_return_type_hint_example.py b/type_hint_arrow_samples/str_return_type_hint_example.py index 40245b8057..9f3be46926 100644 --- a/type_hint_arrow_samples/str_return_type_hint_example.py +++ b/type_hint_arrow_samples/str_return_type_hint_example.py @@ -1,4 +1,5 @@ import random + def get_game_recommendation(list) -> str: return random.choice(list) From 53e11d852d0607e188342714411fdd914e192759 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Tue, 24 Jun 2025 10:33:12 -0400 Subject: [PATCH 08/57] Update str_return_type_hint_example.py From e9688a7f29b0233b73059213d98d5388ccb5cfc3 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sat, 5 Jul 2025 12:26:24 -0400 Subject: [PATCH 09/57] Update simple_type_hint_example.py Updated parameter name and added type hint for parameter --- type_hint_arrow_samples/simple_type_hint_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type_hint_arrow_samples/simple_type_hint_example.py b/type_hint_arrow_samples/simple_type_hint_example.py index 962e45a957..c72cc9db87 100644 --- a/type_hint_arrow_samples/simple_type_hint_example.py +++ b/type_hint_arrow_samples/simple_type_hint_example.py @@ -1,5 +1,5 @@ -def get_number_of_titles(list) -> int: - return len(list) +def get_number_of_titles(titles: list) -> int: + return len(titles) game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] print(f"Number of titles: {get_number_of_titles(game_titles_list)}") From 9ff41d9cdac3d950150be5fcb31cf92fc9c7f67a Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:18:33 -0400 Subject: [PATCH 10/57] Update str_return_type_hint_example.py --- type_hint_arrow_samples/str_return_type_hint_example.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/type_hint_arrow_samples/str_return_type_hint_example.py b/type_hint_arrow_samples/str_return_type_hint_example.py index 9f3be46926..d3f5a12faa 100644 --- a/type_hint_arrow_samples/str_return_type_hint_example.py +++ b/type_hint_arrow_samples/str_return_type_hint_example.py @@ -1,7 +1 @@ -import random -def get_game_recommendation(list) -> str: - return random.choice(list) - -game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] -print(f"Random recommendation: {get_game_recommendation(game_titles_list)}") From c5a15adf3c82dbe27d2e224e20ccecf23d2c56cb Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:19:05 -0400 Subject: [PATCH 11/57] Update str_return_type_hint_example.py --- type_hint_arrow_samples/str_return_type_hint_example.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/type_hint_arrow_samples/str_return_type_hint_example.py b/type_hint_arrow_samples/str_return_type_hint_example.py index d3f5a12faa..d6c6793756 100644 --- a/type_hint_arrow_samples/str_return_type_hint_example.py +++ b/type_hint_arrow_samples/str_return_type_hint_example.py @@ -1 +1,7 @@ +import random +def get_game_recommendation(titles: list) -> str: + return random.choice(titles) + +game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] +print(f"Random recommendation: {get_game_recommendation(game_titles_list)}") From 5fc9bc5faebbf5d867ed398293105826e3d30aad Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:26:44 -0400 Subject: [PATCH 12/57] Update str_return_type_hint_example.py --- type_hint_arrow_samples/str_return_type_hint_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type_hint_arrow_samples/str_return_type_hint_example.py b/type_hint_arrow_samples/str_return_type_hint_example.py index d6c6793756..a3155611f9 100644 --- a/type_hint_arrow_samples/str_return_type_hint_example.py +++ b/type_hint_arrow_samples/str_return_type_hint_example.py @@ -1,7 +1,7 @@ import random -def get_game_recommendation(titles: list) -> str: +def get_game_recommendations(titles: list) -> str: return random.choice(titles) game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] -print(f"Random recommendation: {get_game_recommendation(game_titles_list)}") +print(f"Random recommendation: {get_game_redommendation(game_titles_list)}") From 3b9b2a140333a3a402488f47ba75ed87a8e83036 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:29:44 -0400 Subject: [PATCH 13/57] Update str_return_type_hint_example.py --- type_hint_arrow_samples/str_return_type_hint_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type_hint_arrow_samples/str_return_type_hint_example.py b/type_hint_arrow_samples/str_return_type_hint_example.py index a3155611f9..d6c6793756 100644 --- a/type_hint_arrow_samples/str_return_type_hint_example.py +++ b/type_hint_arrow_samples/str_return_type_hint_example.py @@ -1,7 +1,7 @@ import random -def get_game_recommendations(titles: list) -> str: +def get_game_recommendation(titles: list) -> str: return random.choice(titles) game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] -print(f"Random recommendation: {get_game_redommendation(game_titles_list)}") +print(f"Random recommendation: {get_game_recommendation(game_titles_list)}") From 3e3280e92ca229b99a75ed7b614eb0623cd9fb3e Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:37:15 -0400 Subject: [PATCH 14/57] Update str_return_type_hint_example.py --- type_hint_arrow_samples/str_return_type_hint_example.py | 1 + 1 file changed, 1 insertion(+) diff --git a/type_hint_arrow_samples/str_return_type_hint_example.py b/type_hint_arrow_samples/str_return_type_hint_example.py index d6c6793756..54ccd343df 100644 --- a/type_hint_arrow_samples/str_return_type_hint_example.py +++ b/type_hint_arrow_samples/str_return_type_hint_example.py @@ -1,5 +1,6 @@ import random + def get_game_recommendation(titles: list) -> str: return random.choice(titles) From 406663143c247e4f385302d97715d357afa10a3f Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:45:15 -0400 Subject: [PATCH 15/57] Update str_return_type_hint_example.py --- type_hint_arrow_samples/str_return_type_hint_example.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/type_hint_arrow_samples/str_return_type_hint_example.py b/type_hint_arrow_samples/str_return_type_hint_example.py index 54ccd343df..a546567b42 100644 --- a/type_hint_arrow_samples/str_return_type_hint_example.py +++ b/type_hint_arrow_samples/str_return_type_hint_example.py @@ -1,8 +1,9 @@ import random -def get_game_recommendation(titles: list) -> str: - return random.choice(titles) +def get_game_recommendation(list) -> str: + return random.choice(list) + game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] print(f"Random recommendation: {get_game_recommendation(game_titles_list)}") From 706cfd5c075989dc7ef41df5740d1463248b61eb Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:46:11 -0400 Subject: [PATCH 16/57] Update dictionary_return_type_example.py --- .../dictionary_return_type_example.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/type_hint_arrow_samples/dictionary_return_type_example.py b/type_hint_arrow_samples/dictionary_return_type_example.py index e30f9aed9e..c87d39b737 100644 --- a/type_hint_arrow_samples/dictionary_return_type_example.py +++ b/type_hint_arrow_samples/dictionary_return_type_example.py @@ -1,8 +1,5 @@ -game_stock = { - "Dragon Quest": 5, - "Final Fantasy": 1, - "Age of Empires": 5 -} +game_stock = {"Dragon Quest": 5, "Final Fantasy": 1, "Age of Empires": 5} + def get_highest_stock_game() -> dict[str, int]: stock_quantities = game_stock.values() @@ -11,10 +8,11 @@ def get_highest_stock_game() -> dict[str, int]: if quantity > high: high = quantity game_results = {} - + for game in game_stock: if game_stock[game] == high: game_results[game] = high return game_results -print(f"Games with the highest stock: {get_highest_stock_game()}") \ No newline at end of file + +print(f"Games with the highest stock: {get_highest_stock_game()}") From 5b0e6e308b822339a70413b9c93b0dbdbb333f05 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:46:44 -0400 Subject: [PATCH 17/57] Update dynamic_variable_example.py --- type_hint_arrow_samples/dynamic_variable_example.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/type_hint_arrow_samples/dynamic_variable_example.py b/type_hint_arrow_samples/dynamic_variable_example.py index bd61f79800..0ecdcd2297 100644 --- a/type_hint_arrow_samples/dynamic_variable_example.py +++ b/type_hint_arrow_samples/dynamic_variable_example.py @@ -1,2 +1,2 @@ my_number = 32 -my_number = "32" \ No newline at end of file +my_number = "32" From 9361978b7cd1c31d173a953709b650c4835c7096 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:47:18 -0400 Subject: [PATCH 18/57] Update game_class_example.py --- type_hint_arrow_samples/game_class_example.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/type_hint_arrow_samples/game_class_example.py b/type_hint_arrow_samples/game_class_example.py index 457dcbbcd3..2b35ed7f0d 100644 --- a/type_hint_arrow_samples/game_class_example.py +++ b/type_hint_arrow_samples/game_class_example.py @@ -11,4 +11,4 @@ def get_genre(self) -> str: return self.genre def get_price(self) -> float: - return self.price \ No newline at end of file + return self.price From 41d957aca36184a68c65bf09d1a3cd504079a2dd Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:47:48 -0400 Subject: [PATCH 19/57] Update mismatched_return_type_example.py --- type_hint_arrow_samples/mismatched_return_type_example.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/type_hint_arrow_samples/mismatched_return_type_example.py b/type_hint_arrow_samples/mismatched_return_type_example.py index 2d3064c5e6..2d8c5a9f4f 100644 --- a/type_hint_arrow_samples/mismatched_return_type_example.py +++ b/type_hint_arrow_samples/mismatched_return_type_example.py @@ -1,5 +1,6 @@ def get_number_of_titles(list) -> str: return len(list) + game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] -print(f"Number of titles: {get_number_of_titles(game_titles_list)}") \ No newline at end of file +print(f"Number of titles: {get_number_of_titles(game_titles_list)}") From 32eb1712b3ae469a489f2a759435f658e9fb9c1a Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:48:23 -0400 Subject: [PATCH 20/57] Update none_return_type_hint_example.py --- type_hint_arrow_samples/none_return_type_hint_example.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/type_hint_arrow_samples/none_return_type_hint_example.py b/type_hint_arrow_samples/none_return_type_hint_example.py index c901c5ea3f..2d74833644 100644 --- a/type_hint_arrow_samples/none_return_type_hint_example.py +++ b/type_hint_arrow_samples/none_return_type_hint_example.py @@ -4,5 +4,6 @@ def find_keyword_in_titles(list, keyword) -> None: if keyword in game_title: print(f"{game_title}") + game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] -find_keyword_in_titles(game_titles_list, "Final") \ No newline at end of file +find_keyword_in_titles(game_titles_list, "Final") From 00a783b6399eb7ef340b616cc411c9db4113c037 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:48:50 -0400 Subject: [PATCH 21/57] Update simple_type_hint_example.py --- type_hint_arrow_samples/simple_type_hint_example.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/type_hint_arrow_samples/simple_type_hint_example.py b/type_hint_arrow_samples/simple_type_hint_example.py index c72cc9db87..7c60da3577 100644 --- a/type_hint_arrow_samples/simple_type_hint_example.py +++ b/type_hint_arrow_samples/simple_type_hint_example.py @@ -1,5 +1,6 @@ -def get_number_of_titles(titles: list) -> int: - return len(titles) +def get_number_of_titles(list) -> int: + return len(list) + game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] -print(f"Number of titles: {get_number_of_titles(game_titles_list)}") +print(f"Number of titles: {get_number_of_titles(game_titles_list)}") From 3c3890b38cbc6c4e14a09018e43542213074538f Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:57:01 -0400 Subject: [PATCH 22/57] Update mismatched_return_type_example.py From 22e49413a68b76838a8390bfd75e28e409e9397d Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:57:40 -0400 Subject: [PATCH 23/57] Update none_return_type_hint_example.py From 3b243975c15d2cb6c10417e25a9be0d23697854e Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:57:54 -0400 Subject: [PATCH 24/57] Update mismatched_return_type_example.py From b841a725e510c266a055d5a2a390d6cfbacdb79a Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 17:58:11 -0400 Subject: [PATCH 25/57] Update simple_type_hint_example.py From 43a430d4edf8ebbec8278f1c2d57c10b98b0af89 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 18:01:17 -0400 Subject: [PATCH 26/57] Update simple_type_hint_example.py --- type_hint_arrow_samples/simple_type_hint_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type_hint_arrow_samples/simple_type_hint_example.py b/type_hint_arrow_samples/simple_type_hint_example.py index 7c60da3577..2992bf82b0 100644 --- a/type_hint_arrow_samples/simple_type_hint_example.py +++ b/type_hint_arrow_samples/simple_type_hint_example.py @@ -1,5 +1,5 @@ -def get_number_of_titles(list) -> int: - return len(list) +def get_number_of_titles(titles: list) -> int: + return len(titles) game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] From eb9d01d61c197b0ef615265011439ea7cc1a4951 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 18:02:10 -0400 Subject: [PATCH 27/57] Update none_return_type_hint_example.py --- type_hint_arrow_samples/none_return_type_hint_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type_hint_arrow_samples/none_return_type_hint_example.py b/type_hint_arrow_samples/none_return_type_hint_example.py index 2d74833644..7adc544633 100644 --- a/type_hint_arrow_samples/none_return_type_hint_example.py +++ b/type_hint_arrow_samples/none_return_type_hint_example.py @@ -1,6 +1,6 @@ -def find_keyword_in_titles(list, keyword) -> None: +def find_keyword_in_titles(titles: list, keyword: str) -> None: print(f"Titles that contain the keyword {keyword}") - for game_title in list: + for game_title in titles: if keyword in game_title: print(f"{game_title}") From 6f4da8762837d72d9ea60ec07663c6517f1d8336 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 18:02:44 -0400 Subject: [PATCH 28/57] Update mismatched_return_type_example.py --- type_hint_arrow_samples/mismatched_return_type_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type_hint_arrow_samples/mismatched_return_type_example.py b/type_hint_arrow_samples/mismatched_return_type_example.py index 2d8c5a9f4f..62955a9ee6 100644 --- a/type_hint_arrow_samples/mismatched_return_type_example.py +++ b/type_hint_arrow_samples/mismatched_return_type_example.py @@ -1,5 +1,5 @@ -def get_number_of_titles(list) -> str: - return len(list) +def get_number_of_titles(titles: list) -> str: + return len(titles) game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] From b29e42ad49bc458c8b9c671679b283ec6682ea6a Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 18:25:16 -0400 Subject: [PATCH 29/57] Update simple_type_hint_example.py --- type_hint_arrow_samples/simple_type_hint_example.py | 1 - 1 file changed, 1 deletion(-) diff --git a/type_hint_arrow_samples/simple_type_hint_example.py b/type_hint_arrow_samples/simple_type_hint_example.py index 2992bf82b0..6dd69cd6c9 100644 --- a/type_hint_arrow_samples/simple_type_hint_example.py +++ b/type_hint_arrow_samples/simple_type_hint_example.py @@ -1,6 +1,5 @@ def get_number_of_titles(titles: list) -> int: return len(titles) - game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] print(f"Number of titles: {get_number_of_titles(game_titles_list)}") From d7a5f898dec353460ec1bdd8c99db0fe62dec5e9 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 18:26:48 -0400 Subject: [PATCH 30/57] Update simple_type_hint_example.py --- type_hint_arrow_samples/simple_type_hint_example.py | 1 + 1 file changed, 1 insertion(+) diff --git a/type_hint_arrow_samples/simple_type_hint_example.py b/type_hint_arrow_samples/simple_type_hint_example.py index 6dd69cd6c9..2992bf82b0 100644 --- a/type_hint_arrow_samples/simple_type_hint_example.py +++ b/type_hint_arrow_samples/simple_type_hint_example.py @@ -1,5 +1,6 @@ def get_number_of_titles(titles: list) -> int: return len(titles) + game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] print(f"Number of titles: {get_number_of_titles(game_titles_list)}") From 184ca23e92871f465f317294298028929002f580 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 18:27:54 -0400 Subject: [PATCH 31/57] Update simple_type_hint_example.py --- type_hint_arrow_samples/simple_type_hint_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type_hint_arrow_samples/simple_type_hint_example.py b/type_hint_arrow_samples/simple_type_hint_example.py index 2992bf82b0..7c60da3577 100644 --- a/type_hint_arrow_samples/simple_type_hint_example.py +++ b/type_hint_arrow_samples/simple_type_hint_example.py @@ -1,5 +1,5 @@ -def get_number_of_titles(titles: list) -> int: - return len(titles) +def get_number_of_titles(list) -> int: + return len(list) game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] From 5a6b4b7f1cc5c0bb7140a1e100f1fd9fcac43b0d Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 18:31:07 -0400 Subject: [PATCH 32/57] Update simple_type_hint_example.py --- type_hint_arrow_samples/simple_type_hint_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type_hint_arrow_samples/simple_type_hint_example.py b/type_hint_arrow_samples/simple_type_hint_example.py index 7c60da3577..2992bf82b0 100644 --- a/type_hint_arrow_samples/simple_type_hint_example.py +++ b/type_hint_arrow_samples/simple_type_hint_example.py @@ -1,5 +1,5 @@ -def get_number_of_titles(list) -> int: - return len(list) +def get_number_of_titles(titles: list) -> int: + return len(titles) game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] From 2d43c10fa1b169b3a78c73594df0a5b98da27529 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 18:33:49 -0400 Subject: [PATCH 33/57] Update str_return_type_hint_example.py --- type_hint_arrow_samples/str_return_type_hint_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type_hint_arrow_samples/str_return_type_hint_example.py b/type_hint_arrow_samples/str_return_type_hint_example.py index a546567b42..60fd661687 100644 --- a/type_hint_arrow_samples/str_return_type_hint_example.py +++ b/type_hint_arrow_samples/str_return_type_hint_example.py @@ -1,8 +1,8 @@ import random -def get_game_recommendation(list) -> str: - return random.choice(list) +def get_game_recommendation(titles: list) -> str: + return random.choice(titles) game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] From e63760754f88eb9715f1bcd26672fde7fe791609 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 19:13:12 -0400 Subject: [PATCH 34/57] Update mismatched_return_type_example.py --- type_hint_arrow_samples/mismatched_return_type_example.py | 1 + 1 file changed, 1 insertion(+) diff --git a/type_hint_arrow_samples/mismatched_return_type_example.py b/type_hint_arrow_samples/mismatched_return_type_example.py index 62955a9ee6..28134902c8 100644 --- a/type_hint_arrow_samples/mismatched_return_type_example.py +++ b/type_hint_arrow_samples/mismatched_return_type_example.py @@ -4,3 +4,4 @@ def get_number_of_titles(titles: list) -> str: game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] print(f"Number of titles: {get_number_of_titles(game_titles_list)}") + From 02f20991a5071b25a0808840dac8b2446ba2a242 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 19:16:45 -0400 Subject: [PATCH 35/57] Update mismatched_return_type_example.py --- type_hint_arrow_samples/mismatched_return_type_example.py | 1 - 1 file changed, 1 deletion(-) diff --git a/type_hint_arrow_samples/mismatched_return_type_example.py b/type_hint_arrow_samples/mismatched_return_type_example.py index 28134902c8..62955a9ee6 100644 --- a/type_hint_arrow_samples/mismatched_return_type_example.py +++ b/type_hint_arrow_samples/mismatched_return_type_example.py @@ -4,4 +4,3 @@ def get_number_of_titles(titles: list) -> str: game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] print(f"Number of titles: {get_number_of_titles(game_titles_list)}") - From 31f97ef6c641c1d36e7a9a6dcfd541f51fb65bcb Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 19:28:33 -0400 Subject: [PATCH 36/57] Renamed samples folder and added a README file --- type-hint-arrow-samples/README.md | 2 ++ .../dictionary_return_type_example.py | 0 .../dynamic_variable_example.py | 0 .../game_class_example.py | 0 .../mismatched_return_type_example.py | 0 .../none_return_type_hint_example.py | 0 .../simple_type_hint_example.py | 0 .../str_return_type_hint_example.py | 0 8 files changed, 2 insertions(+) create mode 100644 type-hint-arrow-samples/README.md rename {type_hint_arrow_samples => type-hint-arrow-samples}/dictionary_return_type_example.py (100%) rename {type_hint_arrow_samples => type-hint-arrow-samples}/dynamic_variable_example.py (100%) rename {type_hint_arrow_samples => type-hint-arrow-samples}/game_class_example.py (100%) rename {type_hint_arrow_samples => type-hint-arrow-samples}/mismatched_return_type_example.py (100%) rename {type_hint_arrow_samples => type-hint-arrow-samples}/none_return_type_hint_example.py (100%) rename {type_hint_arrow_samples => type-hint-arrow-samples}/simple_type_hint_example.py (100%) rename {type_hint_arrow_samples => type-hint-arrow-samples}/str_return_type_hint_example.py (100%) diff --git a/type-hint-arrow-samples/README.md b/type-hint-arrow-samples/README.md new file mode 100644 index 0000000000..929170dfc8 --- /dev/null +++ b/type-hint-arrow-samples/README.md @@ -0,0 +1,2 @@ +What Does -> Mean in Python Function Definitions? +This folder provides the code examples for the Real Python tutorial [What Does -> Mean in Python Function Definitions?](https://realpython.com/what-does-mean-in-python-function-definitions/) \ No newline at end of file diff --git a/type_hint_arrow_samples/dictionary_return_type_example.py b/type-hint-arrow-samples/dictionary_return_type_example.py similarity index 100% rename from type_hint_arrow_samples/dictionary_return_type_example.py rename to type-hint-arrow-samples/dictionary_return_type_example.py diff --git a/type_hint_arrow_samples/dynamic_variable_example.py b/type-hint-arrow-samples/dynamic_variable_example.py similarity index 100% rename from type_hint_arrow_samples/dynamic_variable_example.py rename to type-hint-arrow-samples/dynamic_variable_example.py diff --git a/type_hint_arrow_samples/game_class_example.py b/type-hint-arrow-samples/game_class_example.py similarity index 100% rename from type_hint_arrow_samples/game_class_example.py rename to type-hint-arrow-samples/game_class_example.py diff --git a/type_hint_arrow_samples/mismatched_return_type_example.py b/type-hint-arrow-samples/mismatched_return_type_example.py similarity index 100% rename from type_hint_arrow_samples/mismatched_return_type_example.py rename to type-hint-arrow-samples/mismatched_return_type_example.py diff --git a/type_hint_arrow_samples/none_return_type_hint_example.py b/type-hint-arrow-samples/none_return_type_hint_example.py similarity index 100% rename from type_hint_arrow_samples/none_return_type_hint_example.py rename to type-hint-arrow-samples/none_return_type_hint_example.py diff --git a/type_hint_arrow_samples/simple_type_hint_example.py b/type-hint-arrow-samples/simple_type_hint_example.py similarity index 100% rename from type_hint_arrow_samples/simple_type_hint_example.py rename to type-hint-arrow-samples/simple_type_hint_example.py diff --git a/type_hint_arrow_samples/str_return_type_hint_example.py b/type-hint-arrow-samples/str_return_type_hint_example.py similarity index 100% rename from type_hint_arrow_samples/str_return_type_hint_example.py rename to type-hint-arrow-samples/str_return_type_hint_example.py From 8eb66489369f66a8274baea168799c780a896ed4 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 19:39:48 -0400 Subject: [PATCH 37/57] Update README.md --- type-hint-arrow-samples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/type-hint-arrow-samples/README.md b/type-hint-arrow-samples/README.md index 929170dfc8..994793e65e 100644 --- a/type-hint-arrow-samples/README.md +++ b/type-hint-arrow-samples/README.md @@ -1,2 +1,2 @@ What Does -> Mean in Python Function Definitions? -This folder provides the code examples for the Real Python tutorial [What Does -> Mean in Python Function Definitions?](https://realpython.com/what-does-mean-in-python-function-definitions/) \ No newline at end of file +This folder provides the code examples for the Real Python tutorial [What Does -> Mean in Python Function Definitions?](https://realpython.com/what-does-mean-in-python-function-definitions/) From 1ecf12d054a09a343bcbac51e8519509ddb6549e Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 22:22:38 -0400 Subject: [PATCH 38/57] Update game_class_example.py Added type hints for parameters --- type-hint-arrow-samples/game_class_example.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/type-hint-arrow-samples/game_class_example.py b/type-hint-arrow-samples/game_class_example.py index 2b35ed7f0d..dc1b11210d 100644 --- a/type-hint-arrow-samples/game_class_example.py +++ b/type-hint-arrow-samples/game_class_example.py @@ -1,5 +1,5 @@ class Game: - def __init__(self, name, genre, price) -> None: + def __init__(self, name: str, genre: str, price: float) -> None: self.name = name self.genre = genre self.price = price From 9f43b1365d94cde84faba307835ae781ea56d9fa Mon Sep 17 00:00:00 2001 From: dphoenix Date: Sun, 6 Jul 2025 22:26:47 -0400 Subject: [PATCH 39/57] Update dictionary_return_type_example.py --- type-hint-arrow-samples/dictionary_return_type_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type-hint-arrow-samples/dictionary_return_type_example.py b/type-hint-arrow-samples/dictionary_return_type_example.py index c87d39b737..878b28d20f 100644 --- a/type-hint-arrow-samples/dictionary_return_type_example.py +++ b/type-hint-arrow-samples/dictionary_return_type_example.py @@ -1,7 +1,7 @@ game_stock = {"Dragon Quest": 5, "Final Fantasy": 1, "Age of Empires": 5} -def get_highest_stock_game() -> dict[str, int]: +def get_highest_stock_games() -> dict[str, int]: stock_quantities = game_stock.values() high = 0 for quantity in stock_quantities: @@ -15,4 +15,4 @@ def get_highest_stock_game() -> dict[str, int]: return game_results -print(f"Games with the highest stock: {get_highest_stock_game()}") +print(f"Games with the highest stock: {get_highest_stock_games()}") From c0862adcda341fe7d8ab9f4666341de78d4ab0a1 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Thu, 10 Jul 2025 13:23:01 -0400 Subject: [PATCH 40/57] Update simple_type_hint_example.py --- type-hint-arrow-samples/simple_type_hint_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type-hint-arrow-samples/simple_type_hint_example.py b/type-hint-arrow-samples/simple_type_hint_example.py index 2992bf82b0..1f7470e7c7 100644 --- a/type-hint-arrow-samples/simple_type_hint_example.py +++ b/type-hint-arrow-samples/simple_type_hint_example.py @@ -2,5 +2,5 @@ def get_number_of_titles(titles: list) -> int: return len(titles) -game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] -print(f"Number of titles: {get_number_of_titles(game_titles_list)}") +games = ["Dragon Quest", "Final Fantasy", "Age of Empires"] +print(f"Number of titles: {get_number_of_titles(games)}") From 8cce0b73bbae750e471af6f91dc38a7ef6acb91e Mon Sep 17 00:00:00 2001 From: dphoenix Date: Thu, 10 Jul 2025 13:24:50 -0400 Subject: [PATCH 41/57] Update str_return_type_hint_example.py --- type-hint-arrow-samples/str_return_type_hint_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type-hint-arrow-samples/str_return_type_hint_example.py b/type-hint-arrow-samples/str_return_type_hint_example.py index 60fd661687..e25b4edd89 100644 --- a/type-hint-arrow-samples/str_return_type_hint_example.py +++ b/type-hint-arrow-samples/str_return_type_hint_example.py @@ -5,5 +5,5 @@ def get_game_recommendation(titles: list) -> str: return random.choice(titles) -game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] -print(f"Random recommendation: {get_game_recommendation(game_titles_list)}") +games = ["Dragon Quest", "Final Fantasy", "Age of Empires"] +print(f"Random recommendation: {get_game_recommendation(games)}") From 7fa9ff38044ae2b31b3eb281412b4486e15fb36a Mon Sep 17 00:00:00 2001 From: dphoenix Date: Thu, 10 Jul 2025 13:26:31 -0400 Subject: [PATCH 42/57] Update none_return_type_hint_example.py --- type-hint-arrow-samples/none_return_type_hint_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type-hint-arrow-samples/none_return_type_hint_example.py b/type-hint-arrow-samples/none_return_type_hint_example.py index 7adc544633..b7a682b1d4 100644 --- a/type-hint-arrow-samples/none_return_type_hint_example.py +++ b/type-hint-arrow-samples/none_return_type_hint_example.py @@ -5,5 +5,5 @@ def find_keyword_in_titles(titles: list, keyword: str) -> None: print(f"{game_title}") -game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] -find_keyword_in_titles(game_titles_list, "Final") +games = ["Dragon Quest", "Final Fantasy", "Age of Empires"] +find_keyword_in_titles(games, "Final") From 835a5ac24f08f624cbbf87686b2f9d7617d38bd1 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Thu, 10 Jul 2025 13:27:35 -0400 Subject: [PATCH 43/57] Update mismatched_return_type_example.py --- type-hint-arrow-samples/mismatched_return_type_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/type-hint-arrow-samples/mismatched_return_type_example.py b/type-hint-arrow-samples/mismatched_return_type_example.py index 62955a9ee6..2323e43d1b 100644 --- a/type-hint-arrow-samples/mismatched_return_type_example.py +++ b/type-hint-arrow-samples/mismatched_return_type_example.py @@ -2,5 +2,5 @@ def get_number_of_titles(titles: list) -> str: return len(titles) -game_titles_list = ["Dragon Quest", "Final Fantasy", "Age of Empires"] -print(f"Number of titles: {get_number_of_titles(game_titles_list)}") +games = ["Dragon Quest", "Final Fantasy", "Age of Empires"] +print(f"Number of titles: {get_number_of_titles(games)}") From 38c8d943b36f1e01b896c43904c15e6737e2658c Mon Sep 17 00:00:00 2001 From: dphoenix Date: Fri, 8 Aug 2025 15:57:47 -0400 Subject: [PATCH 44/57] Update simple_type_hint_example.py Added type for list --- type-hint-arrow-samples/simple_type_hint_example.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/type-hint-arrow-samples/simple_type_hint_example.py b/type-hint-arrow-samples/simple_type_hint_example.py index 1f7470e7c7..412a7cd028 100644 --- a/type-hint-arrow-samples/simple_type_hint_example.py +++ b/type-hint-arrow-samples/simple_type_hint_example.py @@ -1,4 +1,4 @@ -def get_number_of_titles(titles: list) -> int: +def get_number_of_titles(titles: list[str]) -> int: return len(titles) From 9c216a960bfa00c53bc3289d30ad41faab58e4dd Mon Sep 17 00:00:00 2001 From: dphoenix Date: Fri, 8 Aug 2025 15:58:19 -0400 Subject: [PATCH 45/57] Update mismatched_return_type_example.py Added type for list --- type-hint-arrow-samples/mismatched_return_type_example.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/type-hint-arrow-samples/mismatched_return_type_example.py b/type-hint-arrow-samples/mismatched_return_type_example.py index 2323e43d1b..4d9c88099e 100644 --- a/type-hint-arrow-samples/mismatched_return_type_example.py +++ b/type-hint-arrow-samples/mismatched_return_type_example.py @@ -1,6 +1,7 @@ -def get_number_of_titles(titles: list) -> str: +def get_number_of_titles(titles: list[str]) -> str: return len(titles) games = ["Dragon Quest", "Final Fantasy", "Age of Empires"] print(f"Number of titles: {get_number_of_titles(games)}") + From 8c8abe4668fae94bfe1e49affaa397cad5b0bd22 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Fri, 8 Aug 2025 16:00:10 -0400 Subject: [PATCH 46/57] Update str_return_type_hint_example.py Added type for list --- type-hint-arrow-samples/str_return_type_hint_example.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/type-hint-arrow-samples/str_return_type_hint_example.py b/type-hint-arrow-samples/str_return_type_hint_example.py index e25b4edd89..a6957e96a3 100644 --- a/type-hint-arrow-samples/str_return_type_hint_example.py +++ b/type-hint-arrow-samples/str_return_type_hint_example.py @@ -1,9 +1,10 @@ import random -def get_game_recommendation(titles: list) -> str: +def get_game_recommendation(titles: list[str]) -> str: return random.choice(titles) games = ["Dragon Quest", "Final Fantasy", "Age of Empires"] print(f"Random recommendation: {get_game_recommendation(games)}") + From c13c9d767455b85c17d731a17187fba8978d2108 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Fri, 8 Aug 2025 16:00:47 -0400 Subject: [PATCH 47/57] Update none_return_type_hint_example.py Added type for list --- type-hint-arrow-samples/none_return_type_hint_example.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/type-hint-arrow-samples/none_return_type_hint_example.py b/type-hint-arrow-samples/none_return_type_hint_example.py index b7a682b1d4..af4955fcdb 100644 --- a/type-hint-arrow-samples/none_return_type_hint_example.py +++ b/type-hint-arrow-samples/none_return_type_hint_example.py @@ -1,4 +1,4 @@ -def find_keyword_in_titles(titles: list, keyword: str) -> None: +def find_keyword_in_titles(titles: list[str], keyword: str) -> None: print(f"Titles that contain the keyword {keyword}") for game_title in titles: if keyword in game_title: @@ -7,3 +7,4 @@ def find_keyword_in_titles(titles: list, keyword: str) -> None: games = ["Dragon Quest", "Final Fantasy", "Age of Empires"] find_keyword_in_titles(games, "Final") + From 1a1015a0924a7058f61c19d2dddcf40e5a977add Mon Sep 17 00:00:00 2001 From: dphoenix Date: Fri, 8 Aug 2025 16:09:06 -0400 Subject: [PATCH 48/57] Update dictionary_return_type_example.py --- .../dictionary_return_type_example.py | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/type-hint-arrow-samples/dictionary_return_type_example.py b/type-hint-arrow-samples/dictionary_return_type_example.py index 878b28d20f..705a8a7dd5 100644 --- a/type-hint-arrow-samples/dictionary_return_type_example.py +++ b/type-hint-arrow-samples/dictionary_return_type_example.py @@ -1,18 +1,9 @@ game_stock = {"Dragon Quest": 5, "Final Fantasy": 1, "Age of Empires": 5} -def get_highest_stock_games() -> dict[str, int]: - stock_quantities = game_stock.values() - high = 0 - for quantity in stock_quantities: - if quantity > high: - high = quantity - game_results = {} - - for game in game_stock: - if game_stock[game] == high: - game_results[game] = high - return game_results - - -print(f"Games with the highest stock: {get_highest_stock_games()}") +def get_highest_stock_games(game_stock: dict[str, int]) -> dict[str, int]: + max_quantity = max(game_stock.values()) + return {game: quantity for game, quantity in game_stock.items() + if quantity == max_quantity} + +print(f"Games with the highest stock: {get_highest_stock_games(game_stock)}") From 7a602e4d1fc6ad1d44076ea38d192f6aeb75239e Mon Sep 17 00:00:00 2001 From: dphoenix Date: Fri, 8 Aug 2025 16:11:22 -0400 Subject: [PATCH 49/57] Update dictionary_return_type_example.py --- type-hint-arrow-samples/dictionary_return_type_example.py | 1 - 1 file changed, 1 deletion(-) diff --git a/type-hint-arrow-samples/dictionary_return_type_example.py b/type-hint-arrow-samples/dictionary_return_type_example.py index 705a8a7dd5..126c40c762 100644 --- a/type-hint-arrow-samples/dictionary_return_type_example.py +++ b/type-hint-arrow-samples/dictionary_return_type_example.py @@ -1,6 +1,5 @@ game_stock = {"Dragon Quest": 5, "Final Fantasy": 1, "Age of Empires": 5} - def get_highest_stock_games(game_stock: dict[str, int]) -> dict[str, int]: max_quantity = max(game_stock.values()) return {game: quantity for game, quantity in game_stock.items() From 2d0daeef6c6967df9db2ff7aa16b219d420b2146 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Fri, 8 Aug 2025 16:15:39 -0400 Subject: [PATCH 50/57] Update dictionary_return_type_example.py --- .../dictionary_return_type_example.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/type-hint-arrow-samples/dictionary_return_type_example.py b/type-hint-arrow-samples/dictionary_return_type_example.py index 126c40c762..d0bc7aace1 100644 --- a/type-hint-arrow-samples/dictionary_return_type_example.py +++ b/type-hint-arrow-samples/dictionary_return_type_example.py @@ -1,8 +1,13 @@ game_stock = {"Dragon Quest": 5, "Final Fantasy": 1, "Age of Empires": 5} + def get_highest_stock_games(game_stock: dict[str, int]) -> dict[str, int]: max_quantity = max(game_stock.values()) - return {game: quantity for game, quantity in game_stock.items() - if quantity == max_quantity} - + return { + game: quantity + for game, quantity in game_stock.items() + if quantity == max_quantity + } + + print(f"Games with the highest stock: {get_highest_stock_games(game_stock)}") From 85fed3977ea2d1c4e2f24317495a22d84e329555 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Fri, 8 Aug 2025 16:19:52 -0400 Subject: [PATCH 51/57] Update dictionary_return_type_example.py From 633f0be0a258dca7d029e48fba2ddef75f49f5a1 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Fri, 8 Aug 2025 16:26:23 -0400 Subject: [PATCH 52/57] Update mismatched_return_type_example.py --- type-hint-arrow-samples/mismatched_return_type_example.py | 1 - 1 file changed, 1 deletion(-) diff --git a/type-hint-arrow-samples/mismatched_return_type_example.py b/type-hint-arrow-samples/mismatched_return_type_example.py index 4d9c88099e..8c99bb7c3b 100644 --- a/type-hint-arrow-samples/mismatched_return_type_example.py +++ b/type-hint-arrow-samples/mismatched_return_type_example.py @@ -4,4 +4,3 @@ def get_number_of_titles(titles: list[str]) -> str: games = ["Dragon Quest", "Final Fantasy", "Age of Empires"] print(f"Number of titles: {get_number_of_titles(games)}") - From 56e7cb3b2e29a9bad92fa7de08463880d26f0053 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Fri, 8 Aug 2025 16:27:11 -0400 Subject: [PATCH 53/57] Update str_return_type_hint_example.py --- type-hint-arrow-samples/str_return_type_hint_example.py | 1 - 1 file changed, 1 deletion(-) diff --git a/type-hint-arrow-samples/str_return_type_hint_example.py b/type-hint-arrow-samples/str_return_type_hint_example.py index a6957e96a3..0d7a07a848 100644 --- a/type-hint-arrow-samples/str_return_type_hint_example.py +++ b/type-hint-arrow-samples/str_return_type_hint_example.py @@ -7,4 +7,3 @@ def get_game_recommendation(titles: list[str]) -> str: games = ["Dragon Quest", "Final Fantasy", "Age of Empires"] print(f"Random recommendation: {get_game_recommendation(games)}") - From 25d5d3bb621547adbcd8fd39511f25e274d1c921 Mon Sep 17 00:00:00 2001 From: dphoenix Date: Fri, 8 Aug 2025 16:27:51 -0400 Subject: [PATCH 54/57] Update none_return_type_hint_example.py --- type-hint-arrow-samples/none_return_type_hint_example.py | 1 - 1 file changed, 1 deletion(-) diff --git a/type-hint-arrow-samples/none_return_type_hint_example.py b/type-hint-arrow-samples/none_return_type_hint_example.py index af4955fcdb..3bc8164047 100644 --- a/type-hint-arrow-samples/none_return_type_hint_example.py +++ b/type-hint-arrow-samples/none_return_type_hint_example.py @@ -7,4 +7,3 @@ def find_keyword_in_titles(titles: list[str], keyword: str) -> None: games = ["Dragon Quest", "Final Fantasy", "Age of Empires"] find_keyword_in_titles(games, "Final") - From d49e52351760e10def8192f8a1701946922a54c0 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 12 Aug 2025 10:49:26 +0200 Subject: [PATCH 55/57] Delte ghost file --- ->-in-function-definitions | 1 - 1 file changed, 1 deletion(-) delete mode 100644 ->-in-function-definitions diff --git a/->-in-function-definitions b/->-in-function-definitions deleted file mode 100644 index 8b13789179..0000000000 --- a/->-in-function-definitions +++ /dev/null @@ -1 +0,0 @@ - From 1d004f027e20a4be8340de5efb4fa6013a5bf713 Mon Sep 17 00:00:00 2001 From: Philipp Date: Tue, 12 Aug 2025 10:55:04 +0200 Subject: [PATCH 56/57] Rename folder to match the tutorial slug --- .../README.md | 0 .../dictionary_return_type_example.py | 0 .../dynamic_variable_example.py | 0 .../game_class_example.py | 0 .../mismatched_return_type_example.py | 0 .../none_return_type_hint_example.py | 0 .../simple_type_hint_example.py | 0 .../str_return_type_hint_example.py | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename {type-hint-arrow-samples => what-does-arrow-mean-in-python}/README.md (100%) rename {type-hint-arrow-samples => what-does-arrow-mean-in-python}/dictionary_return_type_example.py (100%) rename {type-hint-arrow-samples => what-does-arrow-mean-in-python}/dynamic_variable_example.py (100%) rename {type-hint-arrow-samples => what-does-arrow-mean-in-python}/game_class_example.py (100%) rename {type-hint-arrow-samples => what-does-arrow-mean-in-python}/mismatched_return_type_example.py (100%) rename {type-hint-arrow-samples => what-does-arrow-mean-in-python}/none_return_type_hint_example.py (100%) rename {type-hint-arrow-samples => what-does-arrow-mean-in-python}/simple_type_hint_example.py (100%) rename {type-hint-arrow-samples => what-does-arrow-mean-in-python}/str_return_type_hint_example.py (100%) diff --git a/type-hint-arrow-samples/README.md b/what-does-arrow-mean-in-python/README.md similarity index 100% rename from type-hint-arrow-samples/README.md rename to what-does-arrow-mean-in-python/README.md diff --git a/type-hint-arrow-samples/dictionary_return_type_example.py b/what-does-arrow-mean-in-python/dictionary_return_type_example.py similarity index 100% rename from type-hint-arrow-samples/dictionary_return_type_example.py rename to what-does-arrow-mean-in-python/dictionary_return_type_example.py diff --git a/type-hint-arrow-samples/dynamic_variable_example.py b/what-does-arrow-mean-in-python/dynamic_variable_example.py similarity index 100% rename from type-hint-arrow-samples/dynamic_variable_example.py rename to what-does-arrow-mean-in-python/dynamic_variable_example.py diff --git a/type-hint-arrow-samples/game_class_example.py b/what-does-arrow-mean-in-python/game_class_example.py similarity index 100% rename from type-hint-arrow-samples/game_class_example.py rename to what-does-arrow-mean-in-python/game_class_example.py diff --git a/type-hint-arrow-samples/mismatched_return_type_example.py b/what-does-arrow-mean-in-python/mismatched_return_type_example.py similarity index 100% rename from type-hint-arrow-samples/mismatched_return_type_example.py rename to what-does-arrow-mean-in-python/mismatched_return_type_example.py diff --git a/type-hint-arrow-samples/none_return_type_hint_example.py b/what-does-arrow-mean-in-python/none_return_type_hint_example.py similarity index 100% rename from type-hint-arrow-samples/none_return_type_hint_example.py rename to what-does-arrow-mean-in-python/none_return_type_hint_example.py diff --git a/type-hint-arrow-samples/simple_type_hint_example.py b/what-does-arrow-mean-in-python/simple_type_hint_example.py similarity index 100% rename from type-hint-arrow-samples/simple_type_hint_example.py rename to what-does-arrow-mean-in-python/simple_type_hint_example.py diff --git a/type-hint-arrow-samples/str_return_type_hint_example.py b/what-does-arrow-mean-in-python/str_return_type_hint_example.py similarity index 100% rename from type-hint-arrow-samples/str_return_type_hint_example.py rename to what-does-arrow-mean-in-python/str_return_type_hint_example.py From 367dd36a6d94e576d1b73c039b32c8a04b3d0bf3 Mon Sep 17 00:00:00 2001 From: brendaweles <160772586+brendaweles@users.noreply.github.com> Date: Tue, 26 Aug 2025 18:53:01 -0600 Subject: [PATCH 57/57] Update README.md --- what-does-arrow-mean-in-python/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/what-does-arrow-mean-in-python/README.md b/what-does-arrow-mean-in-python/README.md index 994793e65e..39354f47dc 100644 --- a/what-does-arrow-mean-in-python/README.md +++ b/what-does-arrow-mean-in-python/README.md @@ -1,2 +1 @@ -What Does -> Mean in Python Function Definitions? This folder provides the code examples for the Real Python tutorial [What Does -> Mean in Python Function Definitions?](https://realpython.com/what-does-mean-in-python-function-definitions/)