57
veky
22 48 64 Leader of the month
44676/ 53887
Last seen 21 hours ago
Member for 11 years, 6 months, 24 days
Difficulty Advanced
We shall not cease from exploration, and the end of all our exploring will be to arrive where we started and know the place for the first time.

Best reviews / Newest reviews
Exception mishandling-veky
I could suppress the StopIteration near the end, but decided this was enough. :-D More
1-liner: quick naming and weird slicing-Phil15 1
Nice, but misses a few tricks. For instance, (-1)**i is much shorter than what you wrote after ::. :-P More
First-santosh.pagare
Line 9 surely shows some misunderstanding of how Python works. What did you think it does (as opposed to just "return data_new")? And of course, you can just write a list comprehension. return [x for x in data if cnt[x] > 1] More
First-Fedorovich 1
Ok, but that prints are cluttering your code. It's ok for debugging, but remove them before publishing. More
Tread carefully...-veky
This is just one example of how PEP 479 is bad for Python. Another one is at https://py.checkio.org/mission/merge-intervals/publications/veky/python-3/generator/#comment-54572. More
First-Fedorovich
You can chain comparisons. if number % 3 == number % 5 == 0: Nice to know but not really needed: you can use not % without parentheses (as opposed to C). if not number % 3: More
... because dunders make good clarification-smilicic 1
... not. :-P list(map(blah.__getitem__, days)) [blah[day] for day in days] compare. --- BTW do you write (2 * 5) + 3 ? Then don't do the same with Boolean multiplication and addition. :-P More
Short, but boring.-hrvoje
Every time you map a lambda, a python dies. :-P map(lambda variable: whatever, sequence) ~~~> [whatever for variable in sequence] More
Ebony and Ivory-veky
The title, of course, refers to two different ways of string formatting in Python. They are introduced in lines 4 and 9, and they "live together in perfect harmony" in line 11. :-) More
First-jake-g
def checkio(from_date, to_date): """Count Saturdays and Sundays between dates.""" weeks, days = divmod((to_date - from_date).days, 7) nd = from_date.weekday() + days # next same weekday as to_date return 2*weeks + (nd > 4) + (days and nd > 5) Same algo, 4 times More
str-DiZ 1
Wow, what a cheat! :-D Of course it doesn't always work, but still very nice. Instead of (second) str, you can use id. It is false in rarer occasions. ;-] More
Short-Nep
Short? It's about thrice longer than necessary. ;-P More
First time - intro-DanyC97
Not much of an explanation, is it? :-P More
First-DanyC97 1
Nice idea, though it's not very efficient. :-) More
Myopic :-(-veky
An interesting question: why are parentheses needed? A more interesting question: were they needed in all previous versions of Python? ;-) More
:-D :D- -:D -D: D:- D-: D,_-smilicic 1
`_,-1` But seriously... clear? :-D More
9-liner: moment of clarity -przemyslaw.daniel
It can be factored much more. :-) See [mine](https://py.checkio.org/mission/seven-segment/publications/veky/python-3/spec-lit-broken/). ;-] More
by turning into a list and using indexes-BeginBye
Very inovative, but surely not clear. And it's not that you actually gain anything: since you have to calculate and compare distances for two neighboring items, you could just calculate and compare them for all items. You'd have a linear algorithmic instead of linearithmic sorting one. :-9 More
Ugly piping-smilicic
OMG. filtering a lambda, then listing it, only to iterate through it. Hard to believe this wasn't intentionally ugly. :-P How about for b, w, n in states: if n == n0: (Indenting 2 spaces is acceptable in such situations, if you're stingy with line lengths.) --- states[(b, w, n)] More
One line formula-ermichin158 1
LOL. Yes, sort might be unnecessary, but doing it twice... :-o And it even isn't one line. :-P More