-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
This issue describes how to implement the anonymous functions (lambdas) in Python concept docs.
You can find the related concept exercise issue here
There was some previous discussion in the old concept exercise issue, which you can find 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/creation of anonymous functions (lambdas) in Python.
💡 Learning objectives
- Understand what an
anonymous functionis, and how to create one- The syntax of creating a
lambda - Using different
function argumentflavors withlambda
- The syntax of creating a
- Understand the differences between
lambdasand Pythons "regular"functions - Understand what problems are solved by using a
lambda - The pitfalls of
lambdas, and when to avoid them - Using
lambdasaskey functionsin other situations such assort(),sorted(),min(), andmax() - Applying arguments to a
lambdavia IIFE (immediately invoked function expression) - Anti-patterns when using
lambdas
🚫 Out of scope
Concepts and Subjects that are Out of Scope (click to open)
comprehensionslambdasincomprehensionscomprehensionsinlambdas- using a
decoratoron alambda functools(this will get its own exercise)generatorsmap(),filter(), andreduce()(these will get their own exercise)- using an
assignment expressionor "walrus" operator (:=) in alambda - assigning a variable to a
lambda - using a
lambdawhere a named function is recommended/better
🤔 Concepts
Concepts and Related Concepts this Concept Covers (click to open)
anonymous-functionslambdasfunctions,higher-order functionsfunctions as argumentsfunctions as returnsnested funcitons
↩️ Prerequisites
These are the concepts/concept exercises the student should be familiar with before taking on/learning this concept.
Prereqs (click to open)
basicsbooleanscomparisonsdictsdict-methodsfunctionsfunction-argumentshigher-order functionsiterationlistslist-methodsnumberssequencessetsstringsstring-methodstuples
📚 Resources to refer to
Resources (click to open)
📁 Files to Be Created
File Detail for these Concept Docs (click to collapse/em>)
|
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.