chore: sync content to repo (#10164)
Co-authored-by: nilbuild <4921183+nilbuild@users.noreply.github.com>
This commit is contained in:
1 parent
8d1f351057
commit
fa2028d37c
3 files changed
+17
No files matched your search
@@ -0,0 +1,8 @@
|
||||
# Docstrings and Comments
|
||||
|
||||
Docstrings and comments document what code does and why. A docstring is a string literal placed right after a function, class, or module definition, and it becomes accessible through the object's __doc__ attribute, which tools use to generate documentation automatically. Comments, marked with #, explain specific lines or blocks of code and are ignored by the interpreter. Docstrings typically describe the purpose, parameters, and return value of a function, while comments clarify tricky logic or note reasons behind a particular implementation choice.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
- [@official@Docstring Conventions](https://peps.python.org/pep-0257/)
|
||||
- [@article@Python Comments](https://www.w3schools.com/python/python_comments.asp)
|
||||
@@ -0,0 +1,8 @@
|
||||
# Type Annotations
|
||||
|
||||
Type annotations let developers specify the expected data types of variables, function parameters, and return values in Python. The interpreter does not enforce these hints at runtime, but tools like mypy and pyright use them to catch type errors before execution. A function can declare def add(a: int, b: int) -> int: to signal that it expects integers and returns one. Type annotations make code easier to read and help catch bugs early, especially in larger codebases.
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
- [@official@Type Annotations](https://typing.python.org/en/latest/spec/annotations.html)
|
||||
- [@article@Understanding type annotation in Python](https://blog.logrocket.com/understanding-type-annotation-python/)
|
||||
@@ -7,4 +7,5 @@ Visit the following resources to learn more:
|
||||
- [@article@Variables in Python](https://realpython.com/python-variables)
|
||||
- [@article@Python for Beginners: Data Types](https://thenewstack.io/python-for-beginners-data-types/)
|
||||
- [@article@Python Null (None): Guide to Missing Values and NoneType](https://roadmap.sh/python/null)
|
||||
- [@article@Python Max Int: Understanding Arbitrary Precision Integers](https://roadmap.sh/python/max-int)
|
||||
- [@video@Python Variables and Data Types](https://www.youtube.com/playlist?list=PLBlnK6fEyqRhN-sfWgCU1z_Qhakc1AGOn)
|
||||
Reference in new issue
Block a user