On Fri, 13 Apr 2007 22:46:03 +0200, Bruno Desthuilliers <[EMAIL PROTECTED]> 
wrote:
> Jorgen Grahn a écrit :
...
>> If you distribute a
>> Python program to Unix users in that form, they may not want to know
>> or care which language it's written in. Especially if you decide, a
>> few releases later, that you want to switch to Perl or something.
>
> <troll>
> No one in it's own mind would decide to switch from Python to Perl !-)
> </troll>

I was trolling a bit, too ;-)

Actually, it made sense in my case. It was a typical Perl task -- a
filter regex-parsing a huge (a few hundred megabytes) text file.
Rewriting it in Perl for speed was faster and more readable than
rewriting it in Python for speed.

> More seriously, and as far as I'm concerned, when I want to make a 
> python script (by opposition to a python 'module') available as a unix 
> command, I either use a symlink or a shell script calling the python 
> script.

A symlink yes, but a shell script? Wouldn't it be easier to write a
one-liner (well, two-liner) Python script in that case?

>>>>I'm used to having a
>>>>shebang in every .py file
>>>
>>>An encoding declaration might be more useful IMHO !-)

...

>> I always use both.
>
> Even in modules ?????

Yes, for a few reasons:
- file(1) can tell it's Python source
- I tend to leave unit tests in my modules
- I just started doing that when I first tried Python;
  it's part of my mental boilerplate

I don't claim they are good reasons. And since I strongly dislike
setting the execute bit on things that aren't executable, I should
probably stop using the shebang everywhere, too ...

/Jorgen

-- 
  // Jorgen Grahn <grahn@        Ph'nglui mglw'nafh Cthulhu
\X/     snipabacken.dyndns.org>  R'lyeh wgah'nagl fhtagn!
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to