Back to Programming Languages forum
Is there a way that we can help the interpreter recognize Python (3) code accurately? What does it expect the first line to be? Thanks
Hi!
Thanks for your question! Currently the "algorithm" of recognizing the languages is stupid
enough. It looks like this. You
see, it just tries to detect the language by few keywords and usual thing to mistake Python
for Ruby is something related with end
keyword, I'm afraid. :(
So you can either find a way to write your sources in some different manner - or suggest some change to this primitive recognition-code so we can improve it together :)
Hi Rodion, thanks so much for the quick reply.
If you can modify the code detector to find this string in Python, it would be great help:
#!/usr/bin/python
That would never be triggered by any other language. Please put this check towards the top of the language detection logic.
And can I ask you a favor. I made a mistake when I typed the title of this forum entry. Please change it to:
"Python code is incorrectly recognized as Ruby"
Thanks much Rodion
Carlos
Also the interpreter recognize mistakenly Ruby language. It sees Python code if there wasn't announce tag "def".