-
-
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
[V3] Implement new Concept Exercise: comparisons #2288
Comments
@BethanyG, please I would like to have a review to this issue. Not sure about (a lot of things and):
|
@DavidGerva - apologies for taking so long to give you feedback. Thank you so much for filing this issue and for raising questions about it. I really struggled to zero in on what felt like the "right" collection of functionality here. I am still not sure I got it correct, and we may need to discuss this further with others. As for language -- I changed the title to I think that I added more comparisons for various types, since the Python docs point out that many built-in types have their own comparison rules that might not be intuitive at first glance. I also added an item about comparisons yielding I moved the Having said all that - I am very open to pushback. I could see equal arguments for including comparisons with each built-in type or for pulling it out into an exercise as we have here. @cmccandless @ErikSchierboom - your thoughts? are we on the right track?? |
Some overlap is fine here I feel.
Without having any Python knowledge, it sounds like a sensible thing to do. |
Sounds good to me! |
Oh for &^!#% sake. None of the edits I made to this issue were actually saved. I am so annoyed right now. Apologies everyone for the spam with no purpose. Will re-edit. |
Re-edited with details described above. Chime in if this looks strange.. |
Really nice. I'm glad it was useful to raise the doubts. |
Hello! |
Hi @Limm-jk ! We'd be delighted if you wanted to take up this issue 🌟 Thank you. 🌈 I don't yet have a concept description (apologies for that), but can work on one today/this weekend & post it here when I'm done. LMK here or in Slack if you have any questions or problems. Looking at the list of items to cover, it does look long - so we can have a discussion if it looks like the exercise is going to get too complex. Since these are comparisons (and return booleans), it might be fun to do an extension on the story for bools that we have here: Ghost Gobble Arcade Game -- but you can always come up with your own story 😄 , or you can also use one from this list: exercise stories. Thanks again for volunteering! |
Thank you! |
Hi @Limm-jk! For Slack, I just need an email and I can send you an invite directly. Is the one on your GitHub profile OK to use? I will send an invite there, and we can change it later if you need to. EDIT: Since invites need admin approval, and the admins are in GMT and CET, there will be a delay for Slack. |
@Limm-jk - also - it is ok to start writing now if you are eager to get started. I may not have the concept description written until tomorrow my time (I'm in Pacific time, so I am 17 hours behind you. 😆 ). |
Good! |
This issue has been automatically marked as |
Will be closing this issue, since PR #2420 completes this. Any edits/additions/re-writes will be noted under a different issue. |
This issue describes how to implement the
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:
Please also watch the following video:
Goal
This concept exercise should teach how basic (non-customized) comparisons work in python and how to use them effectively.
Learning objectives
boolean
valuesTrue
andFalse
is
andis not
are for checking an objects identity only==
and!=
compare both the value & type of an object.==
and!=
for certainbuilt-in
types (such as numbers), or for standard library types like decimals, and fractions to allow comparison across and within type.str
) and binary sequences (bytes
&byte array
) cannot be directly compared.built-in
sequence types (list
,tuple
,range
) andbuilt-in
collection types (set
,dict
)None
,NotImplemented
(comparing either should use identity operators and not equality operators because they are singleton objects) andNaN
(NaN is never==
to itself)==
,>
,<
,!=
with numeric types==
,>
,<
,!=
with non-numeric typesis
andis not
to check/verify identityOut of scope
__lt__
,__le__
,__ne__
,__ge__
,__gt__
==
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.__eq__()
dunder method on a specific object to customize comparison behavior.set operations
Concepts
==
,>
,<
,!=
is
andis not
built-in
typesPrerequisites
basics
bools
dicts
lists
sets
strings
tuples
numbers
iteration
Resources to refer to
Hints
Concept Description
(a variant of this can be used for the
v3/languages/python/concepts/<concept>/about.md
doc and this exercisesintroduction.md
doc.)The concept description needs to be filled in here.
Representer
No changes required.
Analyzer
No changes required.
Implementing
Tests should be written using unittest.TestCase and the test file named comparisons_test.py.
Code in the
.meta/example.py
file should only use syntax & concepts introduced in this exercise or one of its prerequisites.Please do not use comprehensions, generator expressions, or other syntax not previously covered. Please also follow PEP8 guidelines.
Help
If you have any questions while implementing the exercise, please post the questions as comments in this issue.
The text was updated successfully, but these errors were encountered: