I'm happy with either solution. In most cases, I'd probably just use the lambda rather than itemgetter unless I knew I'd be working with a large dataset, but either way works fine. itemgetter turns out to be a little bit less expensive, time wise, and you only have to pay the import cost once, so I decided to run with that instead of the lambda.
itemgetter is always such a dilemma for it.
I like how clean and nice it is, but I almost never
use it because adding a whole import just for it feels silly,
especially since lambda x: x[n] is just as long anyway.
Kata says function "takes a list of non-negative integers and strings"
it should be non-negative...
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Thanks, I must not have noticed this :)
"a list of non-negative integers and strings" states clearly that this list can only contain non-negative integers or strings, nothing else :)
What if one of the elements is a float or boolean?
that
;
is disturbing :DUt oh a
;
found it's way into our beautiful Python code :oI tend to use itemgetter because it's cleaner code than the lambda.
I'm happy with either solution. In most cases, I'd probably just use the lambda rather than itemgetter unless I knew I'd be working with a large dataset, but either way works fine. itemgetter turns out to be a little bit less expensive, time wise, and you only have to pay the import cost once, so I decided to run with that instead of the lambda.
itemgetter is always such a dilemma for it.
I like how clean and nice it is, but I almost never
use it because adding a whole import just for it feels silly,
especially since lambda x: x[n] is just as long anyway.
Okay, I'm closing this issue now.
@Sebbe The author wrote this elsewhere, which I think answers your question:
"In Javascript/Coffeescript, you will need to use a nested Array.
In Python, you can use nested lists, nested sets, generators of generators, I wrote it to be pretty flexible."
Please close this issue.
Loading more items...