57
veky
22 48 64 Leader of the month
44668/ 53887
Last seen 15 hours ago
Member for 11 years, 6 months, 23 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
First-asa119
`x` is a _terrible_ name for an element of `NEIGHBORS`. It is most usually used for _one_ coordinate of it. for dx, dy in NEIGHBORS: x, y = col + dx, row + dy (Of course, this is much better expressed with complex numbers, but here it is an overkill.:) And (pun intended:) then the nes More
First-asa119
Here we see how `dict` is really much nicer (functional) way of expressing a switch. Of course, inner `if`s can be written as expressions (or tuples indexed by bool), even if you don't write them as normal algebraic operations. return dict( conjunction = 0 if not x or not y else 1, More
First-asa119
This is really nicely written considering atrocities you've written before ;-) (the only thing I'd change is write lines 9~11 as other = pair.split("-").remove(node).pop() , and maybe write initializers together visited, current = [first], {first} ). More
First-asa119
Golden rule of Python iterating: **iterate through what you need in the loop suite**. If you need just the elements of a sequence, don't iterate through its indices. If you need both (elements and indices), again don't iterate through just indices: use `enumerate` to iterate through both. If you More
First-asa119
`pawns_indexes` is a terrible name. Those are not indexes, in any sense. `pawns_positions` would be much better. Or just `positions`. In line 10 you use destructuring `for`. You really should have used it in line 4 too: for y, x in pawns: positions.add((int(x) - 1, ord(y) - ord("a"))) More
My first solution-kzantar
Look at [this](https://docs.python.org/3.5/library/collections.html#collections.Counter). Python has got you covered. :-) More
Decorator-veky 1
Don't let tidyness of this code fool you. ;-] More
First - lambdas-kryksyh 1
"square" is a very strange name for list of functions, don't you think? :-O More
quite comprehensive-Czarinov 1
Horrible. :-P First, why those empty lines? They don't increase readability, especially since one of lines is too long. sum([... for ...]) ~~~> sum(... for ...) Just drop the []. Generator expressions are nicer, clearer, faster, and use less memory. And you surely don't need list compr More
First-cbrunet
Nice algo. A few Pythonic nitpickings: * It would be nicer if tuples in q were (time, pos,...), then you could just sort them directly by time. Or if you want to be explicit, you could have used namedtuple. * q.pop(0) is slow with no good reason to use it. It would be better to q.sort(reverse=True More
Partial map-veky
Of course, another view at the [current top solution](http://www.checkio.org/mission/striped-words/publications/RRRQ/python-3/first/). More
First-cwahbong
It always bugged me why people import the wrong thing from collections. :-) Counter is obviously more specific, and precisely what you need. And don't map literal lambdas, especially of one variable. You get precisely nothing. sum(map(lambda arg: expr, seq)) ~~~> sum(expr for arg in seq) More
Simple to understand not fancy or efficent-KleinerNull
Not fancy or efficient, I agree. Simple to understand... well. Horrible duplications, indexing instead of unpacking and naming things, superfluous constructs, unnecessary rebindings... and to top it all off, if adict.get(key, False): :-O Even Py2 should have `key in adict` construct by now. More
Clear as the purest water-kamitenshi
I hope you're sarcastic with the title. :-P First, "m" means precisely nothing. Just return it. What's that for doing there?? -1 >= can be more simply written as >. Those are ints. More
For beginners like me, easy to understand -kamitenshi
Beginners are strange. Beginners like you, even stranger. :-DD Anyway, to make it easy to understand also for us poor gurus over here, you could: * remove that trunc, it serves no purpose * remove that list from line 2. It makes no sense to listify it, if the only thing you're going to do with it More
IlovePython-udg23
It seems I'm not the only one getting strange compliments on CiO. Python gets them too. :-D More
First-udg23
I'm not absolutely sure, but I think Py2 also gives you better way of calling replace: ','.join(phrases).replace("right", "left") More
First-udg23
Lines 5 and 7: if i in "([{": if i in ")]}": Line 15: You can just return not stack and not error Or even `not (stack and error)` :-) But really, why error at all? It's not that you can recover anyway. When you find an error, don't set error to True, just `return False`. At the end, More
First-xffox
Horrible. Why while instead of for? :-/ More
This took longer than I think it should have! Feedback?-zebulan 1
Feedback? Too much duplication and too much low-level code. About that uglier-than-toad line 6... if you want to be a wizard, read http://code.activestate.com/recipes/204297-the-secret-name-of-list-comprehensions/. If you don't, just write the loop like normal people. It's not hard. :-) More