-
-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
04b4db7
commit 8346ba2
Showing
13 changed files
with
113 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,6 @@ | ||
import sys | ||
|
||
def add(a: int, b: int) -> int: | ||
"""Adds two integers.""" | ||
return a + b | ||
|
||
def main() -> None: | ||
# Get command-line arguments, skipping the first one (script name) | ||
args = sys.argv[1:] | ||
|
||
# Example of using the add function with incorrect types | ||
# Uncomment this line to see the error | ||
# result = add("5", 10) # This will cause a TypeError, handled in the function | ||
|
||
# Check if any arguments were provided | ||
if not args: | ||
print("Hello, World!") | ||
else: | ||
# Join the arguments with spaces and print the greeting | ||
greeting = "Hello, " + " ".join(args) + "!" | ||
print(greeting) | ||
|
||
def add(a: int, b: int) -> int: return a + b | ||
def main() -> None: print("Hello, " + " ".join(sys.argv[1:]) + "!") | ||
if __name__ == "__main__": | ||
main() | ||
print(add(5, 10)) # Error Example: add("5", 10) will cause a TypeError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 2 additions & 14 deletions
16
example/extending/newlang/6-python-modules/foo/bar/src/bar.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,4 @@ | ||
import sys | ||
|
||
def main() -> None: | ||
# Get command-line arguments, skipping the first one (script name) | ||
args = sys.argv[1:] | ||
|
||
# Check if any arguments were provided | ||
if not args: | ||
print("Hello, World Foo Bar!") | ||
else: | ||
# Join the arguments with spaces and print the greeting | ||
greeting = "Hello, " + " ".join(args) + " Foo Bar!" | ||
print(greeting) | ||
|
||
def main() -> None: print("Hello, " + " ".join(sys.argv[1:]) + " Foo Bar!") | ||
if __name__ == "__main__": | ||
main() | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,4 @@ | ||
import sys | ||
|
||
def main() -> None: | ||
# Get command-line arguments, skipping the first one (script name) | ||
args = sys.argv[1:] | ||
|
||
# Check if any arguments were provided | ||
if not args: | ||
print("Hello, World Foo!") | ||
else: | ||
# Join the arguments with spaces and print the greeting | ||
greeting = "Hello, " + " ".join(args) + " Foo!" | ||
print(greeting) | ||
|
||
def main() -> None: print("Hello, " + " ".join(sys.argv[1:]) + " Foo!") | ||
if __name__ == "__main__": | ||
main() | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,4 @@ | ||
import sys | ||
|
||
def main() -> None: | ||
# Get command-line arguments, skipping the first one (script name) | ||
args = sys.argv[1:] | ||
|
||
# Check if any arguments were provided | ||
if not args: | ||
print("Hello, World Qux!") | ||
else: | ||
# Join the arguments with spaces and print the greeting | ||
greeting = "Hello, " + " ".join(args) + " Qux!" | ||
print(greeting) | ||
|
||
def main() -> None: print("Hello, " + " ".join(sys.argv[1:]) + " Qux!") | ||
if __name__ == "__main__": | ||
main() | ||
main() |
Oops, something went wrong.