Re:Why it’s hard for programmers to write a program to flatt...
by zzzcpan on Friday February 24, 2017 @03:39PM
(#13727667)
> I bet I could find people who had been using perl to do work for years who wouldn't be able to explain what was happening here
Don't jump to conclusions. You will not find such people, because those are very basics. Understanding of $_[0] is necessary to use arguments in Perl functions and understanding of @{...} is necessary to use array references as lists.
Re:Why it’s hard for programmers to write a program to flatt...
by ghshephard on Friday February 24, 2017 @04:05PM
(#13727892)
Challenge accepted.
That's what I meant by native iterative/sequence languages like python lend themselves to easy solutions for this type of question, even for people who aren't programmers, whereas you really need to be a programmer to come up with something as powerful as the above.
Put another way, doing a complex joined query might be a trivial question for someone who knows even the slightest amount of SQL, but would be beyond most novice python developers (without of course just using a SQL select statement...)
I will admit the (dense) perl solution certainly has its own beauty that the more drawn out python solution is lacking, though I'm guessing it could be written in a pythonic way itself...