Sample code for the article on namespace#659
Merged
brendaweles merged 9 commits intomasterfrom Apr 7, 2025
Merged
Conversation
bzaczynski
reviewed
Mar 27, 2025
python-namespace/globals_func.py
Outdated
Comment on lines
3
to
5
| # print(message) | ||
| # globals()["message"] = "Hello, World!" | ||
| # print(message) |
Contributor
Contributor
Author
bzaczynski
approved these changes
Mar 27, 2025
Contributor
bzaczynski
left a comment
There was a problem hiding this comment.
@lpozo Approved with some comments 😉
python-namespace/legb_3.py
Outdated
|
|
||
|
|
||
| def outer(): | ||
| # x = "enclosing" |
python-namespace/locals_func.py
Outdated
Comment on lines
12
to
17
| # print(loc) | ||
| # number = 42 | ||
| # print(f"{loc=}") | ||
| # loc["message"] = "Welcome!" | ||
| # print(f"{loc=}") | ||
| # print(locals()) |
Contributor
There was a problem hiding this comment.
@lpozo These print calls could also use f-strings to keep them consistent with the updated tutorial.
python-namespace/mutability.py
Outdated
|
|
||
|
|
||
| # f() | ||
| # fruits |
Contributor
There was a problem hiding this comment.
@lpozo This should probably be wrapped in a call to print().
brendaweles
approved these changes
Apr 7, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Where to put new files:
my-awesome-articleHow to merge your changes: