Closed BethanyG closed 1 year ago
@BethanyG I'd like to work on this
ghost -- I can't assign you since your GitHub profile has been deleted. If you've created a new profile, please re-comment if you'd like to work on this issue, and I can assign you. Many thanks!
hey @BethanyG, if anyone isnt working on it; I can give this a try !
Hi @kana800 ๐๐ฝ
I am so so sorry!. Your comment slipped through the notification cracks, and I am just now seeing it. ๐คฆ๐ฝโโ๏ธ I do hope you are still interested, and if so ... this issue is all yours! ๐
I will assign you, and just let me know if you still want to work on it/are no longer interested. ๐
As a reminder, there was a previous draft created here, but the author was using lambdas
in a way that was not considered pythonic, so there is some discussion/reworking that probably needs to be done. There are some additional links in the first part of the issue above as well.
@BethanyG
I am so so sorry!. Your comment slipped through the notification cracks, and I am just now seeing it. ๐คฆ๐ฝโโ๏ธ I do hope you are still interested, and if so ... this issue is all yours! ๐
Its totally fine!!
I will assign you, and just let me know if you still want to work on it/are no longer interested. ๐
I am interested on working on it; I will check out the previous drafts and the PRs mentioned and start to work on it
Cheers!
@BethanyG hello ! I am sorry I just saw this now; Sadly I am not able to work on it right away; I am gonna un-assign myself so that anyone else who is interested can work on this.
Really sorry about the inconvenience.
Thanks !
@BethanyG, can I take this up? Thanks!
@safwansamsudeen -- this exercise is closed to contribution. Since the last contributors took it one, we've had a ton of other things (hints, approaches, mentor notes, earlier concept exercises, troubleshooting documents, additional practice exercises, earlier concept exercises ...) take higher priority. Lambdas are also problematic in Python, and I want to think through exactly how we handle them for concept exercises.
I have left the issue here so that we don't lose the requirements and other notes. I will flag it as paused.
This issue describes how to implement the
anonymous functions (lambdas)
in Python concept exercise for the Python track. The related concept documents issue can be found here.In addition, there was some previous discussion in the old concept exercise issue which you can find here and the closed PR, which you can find here
โ Getting started
If you have not yet created or contributed to a concept exercise, this issue will require some upfront reading to give you the needed background knowledge. Some good example exercises to look at in the repo:
๐กExample Exercises๐ก (click to expand)
1. [Little Sister's Vocabulary](https://github.com/exercism/python/tree/main/exercises/concept/little-sisters-vocab) 2. [Meltdown Mitigation](https://github.com/exercism/python/tree/main/exercises/concept/meltdown-mitigation) 3. [Making the Grade](https://github.com/exercism/python/tree/main/exercises/concept/making-the-grade) 4. [Ellen's Alien Game](https://github.com/exercism/python/tree/main/exercises/concept/ellens-alien-game)
We also recommend completing one or more of the concept exercises (they're called "learning exercises") on the website.
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. So, before diving into the implementation, please go through the following documents:General Contributing Docs:
Documents on Language Tracks and Concept Exercises
๐ฏ Goal
The goal of this concept exercise is to teach an understanding/use/creation of
anonymous functions (lambdas)
in Python.๐กLearning objectives
anonymous function
is, and how to create onelambda
function argument
flavors withlambda
lambdas
and Pythons "regular"functions
lambda
lambdas
, and when to avoid themlambdas
askey functions
in other situations such assort()
,sorted()
,min()
, andmax()
lambda
via IIFE (immediately invoked function expression)lambdas
๐ค Concepts
anonymous-functions
lambdas
functions
,higher-order functions
functions as arguments
functions as returns
nested funcitons
๐ซ Topics that are Out of scope
Concepts & Subjects that are Out of Scope (click to expand)
- `comprehensions` - `lambdas` in `comprehensions` - `comprehensions` in `lambdas` - using a `decorator` on a `lambda` - `functools` (_this will get its own exercise_) - `generators` - `map()`, `filter()`, and `reduce()` (_these will get their own exercise_) - using an `assignment expression` or "walrus" operator (`:=`) in a `lambda` - assigning a variable to a `lambda` - using a `lambda` where a named function is recommended/better
โฉ๏ธ Prerequisites
These are the concepts/concept exercises the student should be familiar with before taking on/learning this concept.
Prereqs (click to expand)
๐ Resources for Writing and Reference
Resources (click to expand)
- [Python Docs: Defining Functions](https://docs.python.org/3/tutorial/controlflow.html#defining-functions) - [Python Docs Tutorial: Lambda Expressions](https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions) - [Functions as Objects in Python](https://medium.com/python-pandemonium/function-as-objects-in-python-d5215e6d1b0d) - [Composing Programs: Higher-Order Functions](https://composingprograms.com/pages/16-higher-order-functions.html) - [Learn by Example: Python Lambda Function](https://www.learnbyexample.org/python-lambda-function/) - [Real Python: How to Use Python Lambda Fuctions](https://realpython.com/python-lambda/) - [Trey Hunner: Overusing Lambda expressions in Python](https://treyhunner.com/2018/09/stop-writing-lambda-expressions/)
Exercise Ideas & Stories
Should you need inspiration for an exercise story, you can find a collection here. You can also port an exercise from another track, but please make sure to only to include tasks that actually make sense in Python and that add value for a student. Remove/replace/add tasks as needed to make the concept clear/workable.
๐ Exercise Files to Be Created
File Detail for this Exercise (click to collapse)
* ### Exercise `introduction.md` For more information, see [**Exercise** `introduction.md`](https://github.com/exercism/docs/blob/main/building/tracks/concept-exercises.md#file-docsintroductionmd) - This can summarize/paraphrase the linked concept documents if they have already been created (either the `about` or the `introduction`). The summary does need to have enough information and examples for the student to complete all the tasks outlined for this concept exercise. * ### Exercise `instructions.md` For more information, see [`instructions.md`](https://github.com/exercism/docs/blob/main/building/tracks/concept-exercises.md#file-docsinstructionsmd) Instructions for an exercise usually center on a story that sets up the code challenge to be solved. You can create your own story, or fork one from the ones listed [here](https://exercism.org/docs/building/tracks/stories). Please make sure to give credit to the original authors if you use a story or fork an exercise. * ### Exercise `Exemplar.py` Solution For more information, see [exemplar implementation](https://github.com/exercism/docs/blob/main/building/tracks/concept-exercises.md#file-exemplar-implementation). This file should not use syntax or datas structures not introduced in this exercise or in this exercise's prerequisites. It will be used as an "ideal" solution for the challenge, so make sure it conforms to PEP8 and other formatting conventions, and **does not use single letter variable names**. It should also include proper module and function-level docstrings. However, it should **NOT** include typehinting or type aliases. * ### `
โพ๏ธ Exercise Metadata - Track
For more information on concept exercises and formatting for the Python track
config.json
, please seeconfig.json
. The trackconfig.json
file can be found in the root of the Python repo.You can use the below for the exercise UUID. You can also generate a new one via exercism configlet, uuidgenerator.net, or any other favorite method. The UUID must be a valid V4 UUID.
1e636fd3-6143-484e-a4fc-0ed6157fdfa1
๐ถ Implementation Notes
As a reminder, code in the
.meta/examplar.py
file should only use syntax & concepts introduced in this exercise or one of its prerequisite exercises. We run all ourexamplar.py
files through PyLint, but do not strictly require module docstrings. We do require function docstrings similar to PEP257. See this concept exerciseexemplar.py
for an example.Please do not use comprehensions, generator expressions, or other syntax not previously covered either in the introduction to this exercise, or to one of its prerequisites. Please also follow PEP8 guidelines.
In General, tests should be written using
unittest.TestCase
and the test file should be named<EXERCISE-NAME>_test.py
.PyTest custom mark
to link test cases to exercise task numbers.unittest.subtest
to parameterize test input where/when needed. Here is an example testfile that shows all three of these in action.While we do use PyTest as our test runner and for some implementation tests, please check with a maintainer before using a PyTest-specific test method, fixture, or feature.
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).