On May 7, 2009, at 5:53 PM, Ben Finney wrote:
Doug Hellmann
writes: I write a python script call hello.py like this:
#!/usr/bin/env python
def main(): print 'hello!'
if __name__ == '__main__': main()
Why make me define an entry point for that? I can just put it in /usr/ bin or somewhere in the path on Windows and call it as "hello.py".
To address the issue raised elsewhere in this thread:
Why should the name of a *command* include the suffix ‘.py’? That just begs for the situation down the line where one of these commands is being used widely, by the name ‘hello.py’, and then someone wants to provide an alternative implementation in another language.
I personally don't care if it includes the .py suffix or not, most of the time. I tend not to include it in my own code, and don't get bent out of shape if someone else's tool does use it. Of course, as I've been reminded in this thread not including the .py (and not using entry points) means my "scripts" don't work as-is when installed on Windows. Doug