Difference between revisions of "Python notes"

From Wiki at Neela Nurseries
Jump to: navigation, search
(create page "Python notes")
 
m (Create section "Docstrings", populate with a couple of links to tutorials.)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
2023-10-11 Wednesday
 
2023-10-11 Wednesday
 +
 +
== [[#top|^]] Overview ==
  
 
Python notes local page on Neela Nurseries wiki
 
Python notes local page on Neela Nurseries wiki
  
Question:  what is the syntax or python-ism in this construcxt?:
+
<!-- odne komentar -->
 +
== [[#top|^]] Python Questions ==
 +
 
 +
Question:  what is the syntax or python-ism in this construct?:
  
 
<pre>
 
<pre>
Line 10: Line 15:
 
</pre>
 
</pre>
  
 +
Question:  what is method chaining in Python?
 +
<ul>
 +
*  https://note.nkmk.me/en/python-method-chain-line-break/
 +
</ul>
 +
 +
Question:  what is the difference between a Python library and a Python module?
 +
 +
<!-- odne komentar -->
 +
 +
== [[#top|^]] Python Data Types ==
 +
 +
The following Python3 online documentation page mentions early on how Python distinguishes Unicode strings and 8-bit strings which it also calls 'bytes'.  This may be a starting point to understanding how and when Python3 treats data as bytes:
 +
 +
<ul>
 +
*  https://docs.python.org/3/library/re.html
 +
</ul>
 +
<!-- odne komentar -->
 +
== [[#top|^]] Python Libraries ==
 +
Starting point to describe Python language libraries and cases where they are needed:
 +
<ul>
 +
*  https://docs.python.org/3/library/os.html    . . . os library - "Miscellaneous operating system interfaces"
 +
*  https://docs.python.org/3/library/sys.html  . . . sys library
 +
*  https://docs.python.org/3/library/zlib.html  . . . zlib library
 +
</ul>
 +
 +
<!-- odne komentar -->
 +
 +
== [[#top|^]] Docstrings ==
 +
Python document strings or "docstring" instances are an important feature of Python.  As a newcomer to Python docstrings sound like a way to document Python functions and modules.  Looks like they also provide a way to check return types for correctness or matching to a particular type, and further checks of parameters.
 +
 +
*  https://www.datacamp.com/tutorial/docstrings-python
 +
 +
*  https://stackoverflow.com/questions/14379753/what-does-mean-in-python-function-definitions
 +
 +
<!-- odne komentar -->
 +
 +
== [[#top|^]] Python Modules ==
 +
 +
Python scripting language includes a module called `subprocess`.  Sounds like this module is akin to C library's `exec()` family functions, at least in the functionality it provides.  Starting notes on Python subprocess here:
 +
 +
*  https://www.geeksforgeeks.org/python-subprocess-module/
 +
 +
<!-- odne komentar -->
 +
 +
== [[#top|^]] Strings and Long Lines ==
 +
 +
To express long lines in Python there are a couple of methods.  The `textwrap` library or module contains some utils to help with this.  To use parentheses about a multi-line string also provides a way.
  
 +
<ul>
 +
*  https://note.nkmk.me/en/python-long-string/
 +
</ul>
 +
<!-- odne komentar -->
  
 
<!-- EOF -->
 
<!-- EOF -->

Latest revision as of 17:15, 28 October 2024

2023-10-11 Wednesday

^ Overview

Python notes local page on Neela Nurseries wiki

^ Python Questions

Question: what is the syntax or python-ism in this construct?:

if __name__ == '__main__':
     main()

Question: what is method chaining in Python?

Question: what is the difference between a Python library and a Python module?


^ Python Data Types

The following Python3 online documentation page mentions early on how Python distinguishes Unicode strings and 8-bit strings which it also calls 'bytes'. This may be a starting point to understanding how and when Python3 treats data as bytes:

^ Python Libraries

Starting point to describe Python language libraries and cases where they are needed:


^ Docstrings

Python document strings or "docstring" instances are an important feature of Python. As a newcomer to Python docstrings sound like a way to document Python functions and modules. Looks like they also provide a way to check return types for correctness or matching to a particular type, and further checks of parameters.


^ Python Modules

Python scripting language includes a module called `subprocess`. Sounds like this module is akin to C library's `exec()` family functions, at least in the functionality it provides. Starting notes on Python subprocess here:


^ Strings and Long Lines

To express long lines in Python there are a couple of methods. The `textwrap` library or module contains some utils to help with this. To use parentheses about a multi-line string also provides a way.