

Why I don’t worry about Python losing users - ctoth
http://nothingbutsnark.svbtle.com/why-i-dont-worry-about-pythons-popularity

======
eridius
The described issue is even simpler in shell scripting:

    
    
      cat file1.txt file2.txt | tr A-Z a-z | sort | uniq > whitelist.txt
    

Does this mean people aren't going to move from shell scripting to other
languages? No, it just means the task is particularly suited to scripting like
this, and Python has affordances for scripting.

~~~
moe
Your solution doesn't do the same thing, though. His code doesn't sort.

~~~
mattikus
Sure it does:
[https://gist.github.com/brettcannon/82c4fe68bac30f4ed653#fil...](https://gist.github.com/brettcannon/82c4fe68bac30f4ed653#file-
gistfile1-py-L11)

~~~
moe
Sorry, you are right, I missed that.

Arguably your solution is still different because you sort the input instead
of the output, but that's unlikely to matter here.

~~~
eridius
The only difference is I sort before uniquing, but the python code uniques
before sorting. But the result is identical (and in shell scripting, you can't
unique without sorting first).

Although FWIW I just checked and the `sort` tool actually has a flag for
uniquing during the sort. I don't know if that's portable though.

~~~
moe
Yes. Pedantically speaking his solution may be faster for the pathological
case of the input consisting almost entirely of duplicates.

------
mkozlows
Ten lines of Python? That's a one-liner in Perl, and not one of those over-
long ones. So I'd be careful about using that as proof that your language is
safe from encroachment.

Really, the time that people start posting "Why Language X Isn't Dying" is
about the time you should consider freshening your tech skills to a new
language, in my experience.

------
moe
You could also do it in one line:

    
    
       cat file1 file2 | awk '!_[tolower($0)]++{ gsub(/^[ \t]+|[ \t]+$/, ""); print}'
    

Does that mean awk doesn't have to worry either?

------
maxpersson
I wouldn't say it's a fair comparison on the amount of code as no exception
handling at all was done in Python, where several ifs where used in Go...

------
clubhi
I'd like to think Python has more going for it than being a bad Perl

