User talk:OrphicBot/data tables sharder.py
Latest comment: 8 years ago by JohnC5 in topic Angle bracket madness!
Angle bracket madness!
editYou do realize that for function calls like sum()
and join()
you don't have to put the comprehension in a separate set of brackets? So:
def hash(N,s) : return sum([x for x in s.encode('utf-8')])%N
becomes:
def hash(N,s) : return sum(x for x in s.encode('utf-8'))%N
I'd imagine that the bare comprehension (which I assume is a generator) is faster because the list constructor is not called. Just sayin'. —JohnC5 23:57, 19 July 2016 (UTC)
- @JohnC5: Thank you! You just turned my periphrastic hylomorphism into a catamorphism! [FYI: I did not know.] Isomorphyc (talk) 17:55, 20 July 2016 (UTC)
- @Isomorphyc: I do my darnedest! —JohnC5 18:06, 20 July 2016 (UTC)