So I was making a python test file called ".py" and I tried typing some code. Then, there was no syntax highlighting. Why does that happen? Also, when I changed the name to "test.py" there was highlighting. I use idle on windows 10 and I also tried on my dad's computer and naming the file ".py" didn't have any highlighting.
All Python files are internally Python modules, and the names of modules are the string before the .py
. For example, file test.py
is a module named test
.
If you are creating a file named only .py
, then the module name is essentially nothing, which is not valid.
For further information about naming Python modules or packages, read this: PEP8 -- Style Guide for Python Code.
In addition, for UNIX-like operating systems and modern Windows, files starting with .
conventionally means hidden files that contain configuration information. For example, there is a configuration file for bash called .bashrc
that runs every time a shell starts.