57
veky
22 48 64 Leader of the month
44584/ 53887
Last seen 23 hours ago
Member for 11 years, 6 months, 7 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-reddog 4 2
Ok, first: Too. Many. Comments. Really. This is not C, where you write the code primarily for the processor, so you have to explain to the human readers as an afterthought. Here you write pseudocode, that is incidentally executable. Having so many comments indicates you're misunderstanding someth More
First-Sim0000 3 1
Nice. BTW, there are set literals in Python: set([first, second]) -> {first, second}. More
First-michael.kej 3
Cool. :-) You can use .count('1', 2) to be explicit you're starting to count from position 2 (here it doesn't matter, but it could if someone decides to count zeros instead). More
First-michael.kej 3 1
.replace('0', '1') is really a hack. :-) If you want to be clear, if (or filter) would be better. Also, total is a strange name for a product. ;-) More
Clear and pythonic-nakanohito_piyo 3 1
Namespace dicts are usually initialized via kwargs. dict(e=1, a=1, i=1, ...) [Of course, you might argue whether VALUES _is_ a namespace dict, but I think the readability gain is positive anyway.:] --- Otherwise, as opposed to many solutions that are claimed to be clear and Pythonic, this on More
birth certifiDate-veky 3 1
* jackdied: Does your class have two methods, one of which is `__init__`? * veky: errrm... no? :-) ([context](https://youtu.be/o9pEzgHorH0?t=180)) More
First-RRRQ 3 1
The algorithm is beautiful, of course - but others told you that. Code, not so much. You use various antipatterns here (`.find` instead of `in`, over-and-over-again producing of new strings with `.replace`, nested `if`s, treating digits specially, hardcoding a lot more than needed...) and those spac More
WordsFinder-bunnychai 3 1
re is obviously an overkill here. With the necessary escaping it is even longer than ordinary index (or my approach:). And you don't even use IGNORECASE. Nice use of bisect.insort. :-) That ugly offset calculating can be completely removed, if only you replace "enumerate" with "reversed" in li More
Using +-veky 3 4
In other words, I think you really need to disallow eval. :-D More
First-gflegar 3 1
1. That converting to binary (BTW did you know about bin function?) has way too many parentheses for my taste. :-) 1<< has too low priority, 2** has big enough (and optimizer is smart enough). Outer () around bool are superfluous, probably a remnant of C casting thinking:-D. And cast to bool is not More
Sorted-t4n017 3 1
Much clearer: define min_max with its true signature (reverse:bool, *args, key=None) and say min = functools.partial(min_max, False) max = functools.partial(min_max, True) More
Union Find-bukebuer 3 1
Nice UF. But of course you don't need a class. Line 44: You don't need `list()`. In fact you don't need `set()` either. ;-] Line 45: `sorted(eggs, key=spam)[-1]` is also known as `max(eggs, key=spam)`. Timsort _is_ damn fast, but max is linear. :-) Line 19: see `dict.fromkeys`. Very useful and fe More
Dijkstra-PositronicLlama 3 2
Nice and straightforward. But Dijkstra is massive overkill. The point is, there are only two paths (+ degenerate case) you have to explore. See my solution, I can write it in long form if you need. More
BFS-htamas 3 1
Do you _really_ write this on your mobile phone? And does it have Python installed? :-) More
First-gflegar 3
1. sequences are boolable. "if not l" is more pythonic than "if len(l) == 0". 2. candidates can be written as a big list comprehension (again, it doesn't have to be in one line, in fact it can have the same structure as your original lines 6, 7 and 8). 3. range(0,10) is just range(10). Think o More
First-Uladzimir 3 1
abs is a function, no need to lambdize it. :-) More
Set of edges-nickie 3 1
frozenset is much simpler than tuple of sorted, since there are no repetitions. itertools.chain is an overkill (fortunately you didn't use itertools.chain.from_iterable, a powerful function with a horrible name:). set().union is all you need. ;-) BTW the "chopsticks" in the last two lines are real More
defaultdict-ciel 3 2
As you see from the comments, methodcaller is good from educational point of view. :-) But there is a much easier way: just use unbound method. map(str.split, calls) More
Connecting the dots-veky 3
@oduvan: Much improvement. I usually solve your missions with just one import from stdlib, now I had to use three. :-D More
slice-gyahun_dash 3 1
Cool. Not really general, but here is a nice hack someone might find amusing: you can replace max(0, x - 1) with x - bool(x). ;-) More