Skip to main content

Timeline for Python palindrome program

Current License: CC BY-SA 4.0

20 events
when toggle format what by license comment
Feb 1, 2020 at 5:00 history rollback C.Nivs
Rollback to Revision 5
Jan 31, 2020 at 13:19 comment added Peilonrayz @Baldrickk I was rather astonished when I saw the normalization. So, to me, it violates that too.
Jan 31, 2020 at 13:11 comment added Baldrickk @Peilonrayz if you want to implement it as a pair of functions, then that's fine, but the principle of least astonishment would be to provide the defined correct answer to is_palindrome(value) and not have to call is_palindrome(filter_to_alpha(value)) to get the correct result.
Jan 31, 2020 at 13:08 comment added Baldrickk @Peilonrayz palindromes as defined in a language basis only involve the letters. For example, "Don’t nod." is a palindrome, despite being different to ".don t'noD". Therefore a palindrome checker is expected to make the conversion. If you were writing up formal requirements, that would be one. Mangling input is done all the time - if I want a phone number off you, I don't care if you write 01234 567 890 or 01234567890 or 0123 45 67 890 - all I care about is the data that represents - the presentation of that is separate. palindromes are about the characters, so that's what you test.
Jan 30, 2020 at 21:32 history edited C.Nivs CC BY-SA 4.0
added 591 characters in body
Jan 30, 2020 at 19:38 comment added Peilonrayz "does that make the review bad?" To me; when an answer add a problem that the OP didn't - yes.
Jan 30, 2020 at 18:57 comment added C.Nivs @Peilonrayz Maybe so, but if I don't include that, does that make the review bad? Normally I'm not one to argue with suggestions, but a review does not have to cover every facet of code. Do I need to cover code down to the nth possible standard for it to be correct? I don't see that outlined in How to Answer
Jan 30, 2020 at 17:22 comment added Peilonrayz To be clear, this is continuing to violating SRP in the same way.
Jan 30, 2020 at 16:41 history edited C.Nivs CC BY-SA 4.0
added 27 characters in body
Jan 30, 2020 at 16:36 history edited C.Nivs CC BY-SA 4.0
added 27 characters in body
Jan 30, 2020 at 16:33 comment added C.Nivs @Baldrickk the midpoint slice suggestion is a really good one for longer strings, thanks
Jan 30, 2020 at 16:30 comment added C.Nivs @Peilonrayz I made an edit to more clearly outline options OP could use. Again, a lot of this starts to just turn into personal taste based on how the code is supposed to be used, but hopefully this is a bit more clear
Jan 30, 2020 at 16:28 history edited C.Nivs CC BY-SA 4.0
added 1823 characters in body
Jan 30, 2020 at 15:55 comment added Peilonrayz @Baldrickk And why o' why would I ever want my is_palindrome to mangle my input? Not only does it violate SRP, it makes absolutely no sense for it to be there. If you want to check if only the alpha is a palindrome, then make a filter_to_alpha function and use is_palindrome(filter_to_alpha(value)).
Jan 30, 2020 at 14:55 comment added Baldrickk An additional note - you don't need to compare the full string x with its reverse - you need only compare the first half with the reverse of the second half.
Jan 30, 2020 at 14:53 comment added Baldrickk @Peilonrayz it could easily be made to be alphanumeric, which would make sense, but it does show the method by which would be done, so I wouldn't fault the answer for this.
Jan 30, 2020 at 14:49 comment added C.Nivs @Peilonrayz sure, that didn't appear to be OP's use case. I didn't see any clarification from OP that this needed to be the case, and I don't see how it makes the review wrong. I also mentioned that OP could have this option, but it's not necessary
Jan 30, 2020 at 14:00 comment added Peilonrayz Why have you added str.isalpha? 0w0 is a palindrome, not because you mutilate it to become w.
Jan 29, 2020 at 17:53 history edited C.Nivs CC BY-SA 4.0
added 109 characters in body
Jan 29, 2020 at 17:43 history answered C.Nivs CC BY-SA 4.0