-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[New Concept Exercise] : rich comparisons #2287
Comments
Nicely written! Thank you so much for logging this, @DavidGerva! |
I'd like to work on this one. |
@DWalz - YAY! Thank you so much for stepping up. 🌟 We look forward to seeing what you come up with! Please reach out here or in our Slack channel should you have any questions or issues. 😄 |
@DWalz -- Please note that the description of this issue has changed, and is now linked to new requirements and documentation. Since it's been a bit since we've heard from you, I'm going to flag this issue |
This should stay open. |
Flagging as close and re-write with new issue template. Also take a look at scope. |
This issue describes how to implement the
rich-comparisons
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:
Watching the following video is also helpful. It is a bit outdated, but is good for describing the general process:
Goal
This concept exercise is meant to teach an understanding/use of
rich comparison
methods in python. It should also generally explain how to override the behavior ofrich comparison
operators and methods.Learning objectives
==
operator calls the dunder method__eq__()
on a specific object, and uses that object's implementation for comparison. Where no implementation is present, the default__eq__()
from genericobject
is used.<
,<=
,!=
,>=
,>
and correspondents dunder methods__lt__
,__le__
,__ne__
,__ge__
,__gt__
__eq__()
dunder method on a specific object to customize comparison behavior.__lt__
,__le__
,__ne__
,__ge__
,__gt__
dunder methods on a specific object to customize comparison behavior.functools.total_ordering
to "shortcut" defining all rich comparison methods for a class.NotImplemented
if the called operation is not implementedOut of scope
Concepts
__eq__
,__lt__
,__le__
,__ne__
,__ge__
,__gt__
dunder methodsPrerequisites
These are the concepts/concept exercises the student needs to complete/understand before solving this concept exercise.
basics
booleans
classes
class-customization
class-inheritance
class-composition
comparisons
dicts
dict-methods
iteration
lists
list-methods
numbers
operator-overloading
sequences
sets
strings
string-methods
tuples
Resources to refer to
Hints
For more information on writing hints see hints
links.json
For more information, see concept links file
concepts/links.json
file, if it doesn't already exist.links.json
document.Concept Description
Please see the following for more details on these files: concepts & concept exercises
Concept
about.md
Concept file/issue: There is currently no issue or files for the concept. They are TBD.
For more information, see Concept
about.md
Concept
introduction.md
For more information, see Concept
introduction.md
Exercise
introduction.md
For more information, see Exercise
introduction.md
Test-runner
No changes required to the Python Test Runner at this time.
Representer
No changes required to the Python Representer at this time.
Analyzer
No changes required to the Python Analyzer at this time.
Exercise Metadata - Track
For more information on concept exercises and formatting for the Python track
config.json
, please see concept exercise metadata. 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.
0fc646ac-667e-4fc9-bdee-9be7d5431987
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.Implementation Notes
Code in the
.meta/examplar.py
file should only use syntax & concepts introduced in this exercise or one of its prerequisite exercises.Please do not use comprehensions, generator expressions, or other syntax not previously covered. 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
.While we do use PyTest as our test runner and for some implementation tests, please check with a maintainer before using a PyTest 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: