-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
OLD functions concept exercise #2353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello @BethanyG, let me know if I can work on this. |
@mukeshgurpude YES! And many thanks for stepping up and taking it on! 🎉 Bear with me: the links at the top for documentation should all be up-to-date, but the links down below in the detail are old, and need updating. I will do that here shortly. Please (as always) let me know if you have any questions or issues or need help. Also - gentle reminder to make sure you update and pull in all changes from upstream before getting a start. I recommend rebasing |
Heya @mukeshgurpude, Do you need me to look at some drafts of the exercise for you? Or do you have any questions? Feel free to ping me here, or submit a draft PR that we can look at and ping me there. You can also always ping me on slack! Good luck and happy coding! 🐍 |
Hello @J08K, |
Cool, focus on your exams first ofcourse! Goodluck. Tag me in your draft PR when you make it. :) |
@BethanyG Any idea for what you want to see for the exercise here? Any analogous exercise you might want transcribed from another track? I can start looking at the tracks I'm familiar with. Nothing comes to mind right now. |
Rust uses lasagna, but we use lasagna for basics. Go uses Booking Up For Beauty, but that also makes significant use of string formatting, so it might not be as focused for functions as desired. |
@bobahop there are a few things to note here:
I'll add some thoughts/ideas to the new issue. |
Closing this in favor of #3121 |
This issue describes how to implement the
functions
concept and 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:
Goal
This
functions
concept + concept exercise is meant to teach a deeper understanding and use offunctions
in Python. It should also explain how Python treats/views functions (as callable objects).Learning Objectives
In Scope
scopes
andnamespaces
global
andnonlocal
keywords and when to use themreturn
, and the difference between explicit and implicitreturn
None
functions
areobjects
in Python, and that they havetypes
functions
can be assigned to variables, used in expressions, and stored in various data structures such asdicts
orlists
functons
that are assigned to variables, used in expressions, and stored in different data structures.functions
that are/can be nested inside one anothercallable object
.function object
is created by afunction definition
.Out of scope
named parameters
(these can be touched on if needed)default parameters
(these can be touched on, if needed)arbitrary parameters
*args & **kwargs
keyword-only arguments
/
and*
for requiring parameter typesfunctions-as-arguments
(this can be mentioned, but shouldn't be required for the exercise)functions-as-returns
(_this can be mentioned, but will be covered in-depth inhigher-order functions
)closures
(these will be covered in a different exercise)decorators
(these will be covered in a different exercise)functools.wraps
(this is used mostly for decorators)functools
(this will get its own exercise)comprehensions
generators
lambda
,anonymous functions
(these will be covered in a different exercise)recursion
Concepts
callable objects
first-class functions
global
nested functions
nonlocal
return
,implicit return
,explicit return
scope
function attributes
Prerequisites
Proposed Prerequisites
These are the concepts/concept exercises the student needs to complete/understand before solving this concept exercise. Since
functions
is a a bit of a "meta" topic, these can be adjusted to fit the parameters of the exercise, if needed.basics
bools
comparisons
lists
list-methods
loops
numbers
strings
string-methods
Resources to Refer To
Links to resources
nonlocal
Statement (Python Docs)global
Statement (Python Docs)Concept Files to Be Created
Please see the following for more details on these files: concepts
links.json
For more information, see concept links file
concepts/links.json
file, if it doesn't already exist.links.json
document.Concept
about.md
For more information, see Concept
about.md
Concept
introduction.md
For more information, see Concept
introduction.md
about.md
document listed above, and will provide a brief introduction of the concept for a student who has not yet completed the associated concept or practice exercises. It should contain a good summation of the concept, but not go into lots of detail.Exercise Files to Be Created
Exercise
introduction.md
For more information, see Exercise
introduction.md
about
or theintroduction
), and can copy the concept introduction verbatim. But 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
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. Please make sure to give credit to the original authors if you use a story or fork an exercise.
Exercise Exemplar Solution
For more information, see 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 Stub for Implementation
For more information, see stub implementation.
This file should provide the expected function names imported for testing, and optionally TODO comments and or docstrings to aid the student in their implementation. TODOs and docstrings are not required.
Exercise Test Files
For more information, see Tests.
Additionally, please note that Python associates exercise tasks to tests via a Pytest Marker, and uses
unittest subtests
as a form of test paramaterization. See the test file forLittle Sisters Vocab
for examples of how these techniques work.Exercise Hints
For more information on writing hints see
hints.md
Exercise Metadata Files Under
.meta/config.json
For more information on exercise
.meta/
files and formatting, see concept exercise metadata files.meta/config.json
- see this link for the fields and formatting of this file..meta/design.md
- see this link for the formatting of this file. Please use the Goal, Learning Objectives,Concepts, Prerequisites and , Out of Scope sections from this issue.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.
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.
Help
If you have any questions while implementing the exercise, please post the questions as comments in this issue, or contact one of the maintainers on our Slack channel.
The text was updated successfully, but these errors were encountered: