[Improve Concept Docs]: `functools` Module in Python
This issue describes desired additions and improvements to the functools module concept docs..
The related concept exercise issue and specs can be found here,
If you have not yet contributed to concept documents, this issue will require some upfront reading to give you the needed background knowledge. Additionally, we recommend reading the existing about.md docs here, and an example of completed concept docs here.
â Getting started
Please please read the docs before starting. Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism's maintainers' time.
General Contributing Docs:
- Contributing to Exercism | Exercism and GitHub | - Contributor Pull Request Guide
- What are those Weird Task Tags about?
- Exercism Formatting and Style Guide
- Exercism Markdown Specification
- Reputation
Documents on Language Tracks and Concepts:
đđŊ Desired Improvements and Changes
Generally, re-read the documents from a student perspective, improving tone, explanations, and examples. Currently, the documents read as if they are documentation, and not teaching docs.
- [ ] Clean up
introduction.md, so that it only introduces the module, and gives reasons why one would use the tools. It's also OK to list the tools that will be covered, but not to go into detail. Please also remove the function signatures and highlighting. Remember: this is the doc a student sees before going through the exercise, so it is best not to bog them down with too much detail. - [ ] Add more about what the module does, and why one would want to use the tools in the module to both the
about.mdand theintroduction.md - [ ] Add real links to
links.jsonfor further student study/learning - [ ] Remove the highlighted function signatures from the doc, and re-work the text to be more narrative and focused on usage and explanation, rather than reading like a copy of the Python documentation.
- [ ] Provide better use-cases and real-world code examples for the functions covered.
- [ ] Provide better use-case, explanation and examples for
update_wrapperandwraps. If this feels forced, remove the methods and let a maintainer know. We may move these to thedecoratorsconcept.
đ Original Specifications
Below are the original specifications from the Concept issue. Please use these as a guide in addition to the change list above.
This issue describes how to implement the functools module concept docs..
You can find the related concept exercise issue here
If you have not yet contributed to concept documents, this issue will require some upfront reading to give you the needed background knowledge.
â Getting started
Please please read the docs before starting. Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism's maintainers' time.
General Contributing Docs:
- Contributing to Exercism | Exercism and GitHub | - Contributor Pull Request Guide
- What are those Weird Task Tags about?
- Exercism Formatting and Style Guide
- Exercism Markdown Specification
- Reputation
Documents on Language Tracks and Concepts:
đ¯ Goal
These concept docs are meant to teach an understanding/use of the functools module in Python.
đĄ Learning objectives
Learn more about the functional tools the Python Standard Library provides through the functools module.
Build and understanding of and use the following methods and decorators from the module:
-
functools.partial()-
partial.func -
partial.args -
partial.keywords
-
-
class
functools.partialmethod() -
class
functools.singledispatchmethod() -
functools.cache() -
@functools.lru_cache() -
@functools.singledispatch-
@<function>.register()
-
-
@functools.wraps()-- (these might move to thedecoratorsexercise, depending on how difficult they are to work in)-
functools.update_wrapper()
-
- ~~
@functools.cached_property()~~ (this seems better inclass_customization) - ~~
@functools.total_ordering~~ (this method seems more appropriate in therich comparisonsexercise)
đĢ Out of scope
Concepts and Subjects that are Out of Scope
-
classes&class customizationbeyond the direct use of the class methods in this module. -
comprehensions -
comprehensionsinlambdas -
decorators(these have their own exercise. See issue #2356 ) -
map(),filter()orfunctools.reduce()in acomprehension -
functools.reduce()(this was already covered withmap()andfilter()) -
generators, beyond what is in this module - using an
assignment expressionor "walrus" operator (:=) in alambda - class decorators beyond the ones described in this module.
-
enums
đ¤ Concepts
Concepts/Related Concepts Under this Topic
- functional tools in python
-
functoolsmodule -
generic functions -
decorators -
higher-order functions -
partial objectsin python/partial evaluationin python -
single dispatch
âŠī¸ Prerequisites
These are the concepts/concept exercises the student should be familiar with before taking on/learning this concept.
Prereqs
-
basics -
bools -
classes -
class-customization -
class-components -
comparisons -
rich-comparisons -
decorators -
descriptors -
dicts -
dict-methods -
functions -
function-arguments -
higher-order-functions -
iteration -
lists -
list-methods -
numbers -
sequences -
sets -
strings -
string-methods -
tuples
đ Resources to refer to
Resources
- Python Docs: Defining Functions
- Python Docs: functional programming HOWTO
- Python Docs: functools module
-
Pthon Module of the Week:
functools- Tools for Maniputlating Fuctions - Florian Dahlitz: Introduction to Python's Functools Module
- PyDanny: Python Partials are Fun!
- Composing Programs: Higher-Order Functions
- Trey Hunner: Ist it a Class or a Function? It's a callable!
- built-ins: Python Docs
- Real Python: Functional Programming in Python: When and How to Use it
đ Files to Be Created
File Detail for this Exercise
|
Please see the following for more details on these files: concepts
|
đļ Implementation Notes
- Example code should only use syntax & concepts introduced within these docs or one of the prerequisite concept exercises or documents. Where possible, please use REPL formatting, unless you are demonstrating pseudo code or a long code block. Please do not use syntax not previously covered in prerequisite topics or exercises. Please also follow PEP8 guidelines.
- Our markdown and JSON files are checked against prettier . We recommend setting prettier up locally and running it prior to submitting your PR to avoid any CI errors.
đ Next Steps & Getting Help
-
If you'd like to work on this issue, comment saying "I'd like to work on this"(there is no real need to wait for a response, just go ahead, we'll assign you and put a[claimed]label on the issue). - If you have any questions while implementing, please post the questions as comments in here, or contact one of the maintainers on our Slack channel.
@Metallifax -- This is the "improve concept docs. Comment to be assigned. đ
:wave: Comment!
@Metallifax -
Evidently, the bot is anxious đ Will fix that up tomorrow my time. Apologies for the ping.
@Metallifax -- Checking in here .. do you still want to work on this? Anything I can do to help?
Putting back in the [help wanted] pile.