Actually since the indexOf is on the array, it must match exactly so it isn't a substring.  I think the intent was (and why it just added to the array) was to make sure that it matched only the extension. Since I moved all of this to a regex the logic is the same since it matches .pyc only to the end of the string which is the same as pulling off the extension.  

This is actually a performance improvement since it doesn't need to calc a substring and do a second test.

I put the old logic and some tests up on jsfiddle: http://jsfiddle.net/P5NUm/9/ 
Let me know if you still think it's a problem.  We can make it a regular expression using this: `\.[^\.]*pyc[^\.]*$`