Difference between revisions of "Python"
From jWiki
Jump to navigationJump to search
(17 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:Computing]] | |||
πππ | πππ | ||
Line 7: | Line 9: | ||
* [https://docs.python.org/3/reference/lexical_analysis.html#index-14 Python's formal guidance on dunders as a reserved class of identifier] | * [https://docs.python.org/3/reference/lexical_analysis.html#index-14 Python's formal guidance on dunders as a reserved class of identifier] | ||
* [https://docs.python.org/3/tutorial/controlflow.html#tut-unpacking-arguments Unpacking Argument Lists] | * [https://docs.python.org/3/tutorial/controlflow.html#tut-unpacking-arguments Unpacking Argument Lists] | ||
* [https://devguide.python.org/parser/ Guide to CPython's Parser] | |||
=== Python Enhancement Proposals (PEPs) === | === Python Enhancement Proposals (PEPs) === | ||
Line 12: | Line 15: | ||
Here in no particular order are some PEPs I find to be interesting reading | Here in no particular order are some PEPs I find to be interesting reading | ||
* [https://www.python.org/dev/peps/pep-0001 (i.e. | * [https://www.python.org/dev/peps/pep-0001 PEP 1 - PEP Purpose and Guidelines (i.e. ''"what the heck is a PEP?"'')] | ||
* [https://www.python.org/dev/peps/pep-0000 PEP 0 - Index of all PEPs] | * [https://www.python.org/dev/peps/pep-0000 PEP 0 - Index of all PEPs] | ||
* [https://www.python.org/dev/peps/pep-0008 PEP 8 - Style Guide for Python Code] | * [https://www.python.org/dev/peps/pep-0008 PEP 8 - Style Guide for Python Code] | ||
Line 18: | Line 21: | ||
* [https://www.python.org/dev/peps/pep-0602 PEP 602 - Annual Release Cycle for Python] | * [https://www.python.org/dev/peps/pep-0602 PEP 602 - Annual Release Cycle for Python] | ||
* [https://www.python.org/dev/peps/pep-0636 PEP 636 - Structural Pattern Matching: Tutorial] | * [https://www.python.org/dev/peps/pep-0636 PEP 636 - Structural Pattern Matching: Tutorial] | ||
* [https://www.python.org/dev/peps/pep-0517 | * [https://www.python.org/dev/peps/pep-0517 PEP 517 - A build-system independent format for source trees] - Information on the modern organization of Python packaging, namely the division of concerns between: | ||
** integration frontends (''"a tool that...attempts...to satisfy [a set of package requirements]"'') | |||
** build frontends (''"a tool that...builds wheels from [source trees/distributions]"'') | |||
** build backends (the thing that actually does the building, at the request of the build frontend | |||
* [https://www.python.org/dev/peps/pep-0518/ PEP 518 - Specifying Minimum Build System Requirements for Python Projects] - i.e. _"what the heck is `pyproject.toml`?"_ | * [https://www.python.org/dev/peps/pep-0518/ PEP 518 - Specifying Minimum Build System Requirements for Python Projects] - i.e. _"what the heck is `pyproject.toml`?"_ | ||
* [https://www.python.org/dev/peps/pep-0513/#platform-detection-for-installers | * [https://www.python.org/dev/peps/pep-0513/#platform-detection-for-installers PEP 513 - A Platform Tag for Portable Linux Built Distributions] - i.e. the `manylinux1` platform target (see [https://www.python.org/dev/peps/pep-0600/ PEP 600] for the modern tagging system) | ||
== Talks == | == Talks == | ||
* [https://www.youtube.com/watch?v=bAcfPzxB3dk Machete-mode Debugging | * [https://www.youtube.com/watch?v=bAcfPzxB3dk Machete-mode Debugging - Ned Batchelder, PyCon 2016] | ||
* [https://www.youtube.com/watch?v=UANN2Eu6ZnM Raymond Hettinger "The Mental Game of Python", PyBay2019] | |||
* [https://www.youtube.com/watch?v=wf-BqAjZb8M Beyond PEP8] - Raymond Hettinger talking about foolish consistency | |||
* [https://www.youtube.com/watch?v=5JnMutdy6Fw Pandas from the Ground up - PyCon 2015] | |||
== Explanations == | == Explanations == | ||
* [https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html Why you shouldn't invoke setup.py directly] | |||
* [https://chriswarrick.com/blog/2018/09/04/python-virtual-environments/ Python Virtual Environments in Five Minutes] | * [https://chriswarrick.com/blog/2018/09/04/python-virtual-environments/ Python Virtual Environments in Five Minutes] | ||
* [https://nedbatchelder.com/text/names1.html | * [https://nedbatchelder.com/text/names1.html Python Names and Values] - a discussion of how name resolution works in Python (e.g. why Python doesn't have "variables") | ||
* [https://nedbatchelder.com/text/unipain.html Pragmatic Unicode] - a crash-course introduction to text encoding, Unicode, and some of the Python pitfalls | * [https://nedbatchelder.com/text/unipain.html Pragmatic Unicode] - a crash-course introduction to text encoding, Unicode, and some of the Python pitfalls | ||
* [https://kate.io/blog/2017/08/22/weird-python-integers/ Weird Python Integers] | * [https://kate.io/blog/2017/08/22/weird-python-integers/ Weird Python Integers] | ||
* [https://effbot.org/zone/call-by-object.htm | * [https://web.archive.org/web/20190117151243/https://effbot.org/zone/call-by-object.htm Python's calling model is "Call By Object"] <!-- (mirror: https://jamesgerity.com/backup/call-by-object.htm) --> | ||
* [http://simeonfranklin.com/blog/2012/jul/1/python-decorators-in-12-steps/ Understanding Python Decorators in 12 Easy Steps!] | |||
* [https://realpython.com/python-memory-management/ Memory Management in Python] - an overview of memory management in CPython | |||
* [https://lwn.net/Articles/725508/ Memory use in CPython and MicroPython] - a comparison of memory management in CPython and MicroPython, based on [https://www.youtube.com/watch?v=d7qEzpnkWaY Kavya Joshi's PyCon 2017 talk] | |||
== Interesting libraries == | == Interesting libraries == | ||
* [https://github.com/aroberge/friendly `friendly`: replacing standard traceback by something easier to understand] | * [https://github.com/aroberge/friendly `friendly`: replacing standard traceback by something easier to understand] | ||
* [https://tenacity.readthedocs.io/en/latest/ `tenacity`: general-purpose retrying library] | |||
=== SciPy stack === | === SciPy stack === | ||
Line 43: | Line 57: | ||
* [https://numpy.org/doc/stable/reference/arrays.indexing.html Numpy: Array Indexing] | * [https://numpy.org/doc/stable/reference/arrays.indexing.html Numpy: Array Indexing] | ||
* [https://numpy.org/devdocs/user/basics.broadcasting.html Numpy: Broadcasting] | * [https://numpy.org/devdocs/user/basics.broadcasting.html Numpy: Broadcasting] | ||
** see also the older [https://scipy.github.io/old-wiki/pages/EricsBroadcastingDoc "Eric's broadcasting doc"] | |||
* [https://mas-dse.github.io/DSE200/cheat_sheets/1_python/6_2_NumPy_for_MATLAB_users.pdf MATLAB to Numpy cheatsheet] | * [https://mas-dse.github.io/DSE200/cheat_sheets/1_python/6_2_NumPy_for_MATLAB_users.pdf MATLAB to Numpy cheatsheet] | ||
== Misc. == | == Misc. == | ||
* [https://sinoroc.gitlab.io/kb/python/packaging_tools_comparisons.html Packaging tools comparisons] (note: slightly out of date in Jan 2024, but still a nice set of tables) | |||
* [https://mayeut.github.io/manylinux-timeline/ `manylinux` timeline] - visualizations of supported manylinux standards/glibc versions in PyPI packages over time | |||
* [https://blog.glyph.im/2023/08/get-your-mac-python-from-python-dot-org.html "Get Your Mac Python From Python.org"] - An excellent summary of the various ways to get a Python installation. Written with MacOS in mind, but much of what it says generalizes to other platforms. | |||
* [https://github.com/nedbat/pkgsample Ned Batchelder's sample package] | |||
* [https://rahul.gopinath.org/post/2019/12/08/python-controlflow/ The Python Control Flow Graph] - Article showing how to build a tool to visualize the CFG of a Python program | * [https://rahul.gopinath.org/post/2019/12/08/python-controlflow/ The Python Control Flow Graph] - Article showing how to build a tool to visualize the CFG of a Python program | ||
* [https://discuss.python.org/t/adopting-recommending-a-toml-parser/4068/67 Mailing list discussion of adding a TOML parser to the standard library] - tl;dr it's still a mess, `toml` isn't maintained enough, `tomlkit` does too much. `tomli` seems to be the leading favorite. | * [https://discuss.python.org/t/adopting-recommending-a-toml-parser/4068/67 Mailing list discussion of adding a TOML parser to the standard library] - tl;dr it's still a mess, `toml` isn't maintained enough, `tomlkit` does too much. `tomli` seems to be the leading favorite. | ||
Line 54: | Line 71: | ||
* [https://azhpushkin.me/posts/python-c-under-the-hood Under the hood of calling C/C++ from Python] | * [https://azhpushkin.me/posts/python-c-under-the-hood Under the hood of calling C/C++ from Python] | ||
* [https://www.evanjones.ca/memoryallocator/ Python's Memory Allocator] - some notes on arena allocation in CPython | * [https://www.evanjones.ca/memoryallocator/ Python's Memory Allocator] - some notes on arena allocation in CPython | ||
* [https://realpython.com/cpython-source-code-guide/ Your Guide to the CPython Source Code] | * [https://realpython.com/cpython-source-code-guide/ Your Guide to the CPython Source Code] | ||
* [https://arpitbhayani.me/blogs/super-long-integers "How python implements super long integers?"] - an excellent article about how CPython implements arbitrarily large integers. | * [https://arpitbhayani.me/blogs/super-long-integers "How python implements super long integers?"] - an excellent article about how CPython implements arbitrarily large integers. | ||
Line 60: | Line 76: | ||
* [http://greenteapress.com/wp/think-python-2e/ Think Python] | * [http://greenteapress.com/wp/think-python-2e/ Think Python] | ||
* [https://automatetheboringstuff.com/ Automate the Boring Stuff with Python] | * [https://automatetheboringstuff.com/ Automate the Boring Stuff with Python] | ||
* [http://lucumr.pocoo.org/2015/11/18/pythons-hidden-re-gems/ | * [http://lucumr.pocoo.org/2015/11/18/pythons-hidden-re-gems/ Python's Hidden Regular Expression Gems] (particularly nice because of the `Scanner` class therein) | ||
* [https://betterprogramming.pub/animating-regular-expressions-with-python-and-graphviz-e0df447b827a Animating Regular Expressions With Python and Graphviz] | |||
* [https://www.heurekadevs.com/a-brief-look-at-cpython-string A Brief Look at Cpython String] |
Latest revision as of 00:40, 12 January 2024
πππ
Official documentation
- Built-in Functions
- Format Specification Mini-Language - for string formatting
- Python's formal guidance on dunders as a reserved class of identifier
- Unpacking Argument Lists
- Guide to CPython's Parser
Python Enhancement Proposals (PEPs)
Here in no particular order are some PEPs I find to be interesting reading
- PEP 1 - PEP Purpose and Guidelines (i.e. "what the heck is a PEP?")
- PEP 0 - Index of all PEPs
- PEP 8 - Style Guide for Python Code
- PEP 257 - Docstring Conventions
- PEP 602 - Annual Release Cycle for Python
- PEP 636 - Structural Pattern Matching: Tutorial
- PEP 517 - A build-system independent format for source trees - Information on the modern organization of Python packaging, namely the division of concerns between:
- integration frontends ("a tool that...attempts...to satisfy [a set of package requirements]")
- build frontends ("a tool that...builds wheels from [source trees/distributions]")
- build backends (the thing that actually does the building, at the request of the build frontend
- PEP 518 - Specifying Minimum Build System Requirements for Python Projects - i.e. _"what the heck is
pyproject.toml
?"_ - PEP 513 - A Platform Tag for Portable Linux Built Distributions - i.e. the
manylinux1
platform target (see PEP 600 for the modern tagging system)
Talks
- Machete-mode Debugging - Ned Batchelder, PyCon 2016
- Raymond Hettinger "The Mental Game of Python", PyBay2019
- Beyond PEP8 - Raymond Hettinger talking about foolish consistency
- Pandas from the Ground up - PyCon 2015
Explanations
- Why you shouldn't invoke setup.py directly
- Python Virtual Environments in Five Minutes
- Python Names and Values - a discussion of how name resolution works in Python (e.g. why Python doesn't have "variables")
- Pragmatic Unicode - a crash-course introduction to text encoding, Unicode, and some of the Python pitfalls
- Weird Python Integers
- Python's calling model is "Call By Object"
- Understanding Python Decorators in 12 Easy Steps!
- Memory Management in Python - an overview of memory management in CPython
- Memory use in CPython and MicroPython - a comparison of memory management in CPython and MicroPython, based on Kavya Joshi's PyCon 2017 talk
Interesting libraries
friendly
: replacing standard traceback by something easier to understandtenacity
: general-purpose retrying library
SciPy stack
- Python visualization landscape
- SciPy lectures
- Numpy ndarray structure under the hood
- Numpy: Array Indexing
- Numpy: Broadcasting
- see also the older "Eric's broadcasting doc"
- MATLAB to Numpy cheatsheet
Misc.
- Packaging tools comparisons (note: slightly out of date in Jan 2024, but still a nice set of tables)
manylinux
timeline - visualizations of supported manylinux standards/glibc versions in PyPI packages over time- "Get Your Mac Python From Python.org" - An excellent summary of the various ways to get a Python installation. Written with MacOS in mind, but much of what it says generalizes to other platforms.
- Ned Batchelder's sample package
- The Python Control Flow Graph - Article showing how to build a tool to visualize the CFG of a Python program
- Mailing list discussion of adding a TOML parser to the standard library - tl;dr it's still a mess,
toml
isn't maintained enough,tomlkit
does too much.tomli
seems to be the leading favorite. - Why you should use
python -m pip
- Under the hood of calling C/C++ from Python
- Python's Memory Allocator - some notes on arena allocation in CPython
- Your Guide to the CPython Source Code
- "How python implements super long integers?" - an excellent article about how CPython implements arbitrarily large integers.
- Common Python Gotchas
- Think Python
- Automate the Boring Stuff with Python
- Python's Hidden Regular Expression Gems (particularly nice because of the
Scanner
class therein) - Animating Regular Expressions With Python and Graphviz
- A Brief Look at Cpython String