python
python copied to clipboard
[New Concept Exercise] : generator-expressions
This issue describes how to implement the generator-expressions concept exercise for the Python track.
Getting started
Please 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 read up on the following documents:
- Contributing to Exercism | Exercism and GitHub | Contributor Pull Request Guide
- What are those Weird Task Tags about?
- Building Language Tracks: An Overview
- What are Concepts?
- Concept Exercise Specifications
- Concept Specifications
- Exercism Formatting and Style Guide
- Exercism Markdown Specification
- Reputation
Goal
The goal of this exercise is to teach the syntax and variants of generator expressions in Python.
Learning objectives
- Understand how a
generator expressionrelates to both alist comprehensionand agenerator - Understand where
generator expressionscan and cannot be utilized - Create a
generator expression - Use a generator expression as an argument to a function such as
''.join()orsum() - Use a generator expression as an element of a comprehension
Out of scope
- Memory and performance characteristics and optimizations
- Generator methods such as
throw()andclose() - Using the
assignment expression(walrus operator) with agenerator expression
Concepts
generator expressions
Prerequisites
basicsconditionalscomparisonsloopsgeneratorsiteratorsiterationlist-comprehensionsother-comprehensions
Resources to refer to
- Generator expressions and list comprehensions (Python official docs)
- Generators (Python official docs)
- List Comprehensions (Python official docs)
- Generator Expressions in Python (Dan Bader)
Hints
Generator Expressionssection of the Python docs tutorial: Generator expressions and list comprehensions (Python official docs)- Generator Expressions in Python (Dan Bader)
After
- Additional
Generator-iterator methods, such asgenerator.send()andgenerator.throw() generator expressions- Asynchronous generator functions
generatorsused as coroutines
Representer
No changes required.
Analyzer
No changes rquired.
Implementing
- Tests should be written using unittest.TestCase, and the test file named list_comprehensions_test.py.
- How to Implement a Concept Exercise in Python
- make-concept-exercise Utility
Help
If you have any questions while implementing the exercise, please post the questions as comments in this issue.
This issue has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as abandoned 🏚 because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Flagging as close and reopen under new issue template.