why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Adriano Ferreira
Many Python scripts I see start with the shebang line #!/usr/bin/env python What is the difference from using just #!python Regards, Adriano. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Adriano Ferreira
On 12/2/05, Klaus Alexander Seistrup [EMAIL PROTECTED] wrote: #v+ $ ls -l /tmp/hello.py -rwxr-xr-x 1 klaus klaus 38 2005-12-02 14:59 /tmp/hello.py $ cat /tmp/hello.py #! python print 'Hello, world!' # eof $ /tmp/hello.py bash: /tmp/hello.py: python: bad interpreter: No such file or

Re: Why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Adriano Ferreira
On 12/2/05, Carsten Haese [EMAIL PROTECTED] wrote: (3) assumes that whatever shell the user is running looks up the shebang executable in the path, which bash, just to name one example, does not do. I think that was the answer I was looking for. So that #!/usr/bin/env python is more portable

Re: Why use #!/usr/bin/env python rather than #!python?

2005-12-02 Thread Adriano Ferreira
On 12/2/05, Klaus Alexander Seistrup [EMAIL PROTECTED] wrote: /me is using bash on linux. I think that was not a bash issue in my case, but a Cygwin/Win32 issue. Windows has some monstruous oddities in order to assure broken behavior of yesterday is here today in the name of compatibility.

Re: XML Newbie needing some serious help..

2005-05-20 Thread Adriano Ferreira
That doesn't appear to be well-formed XML, which isn't a good start... Indeed. rh0dium, you can't have two nodes elements at root level. If you use an enclosing element around the two nodes, your XML becomes well formed. Like this: ?xml version=1.0 standalone=yes ? root !-- generated by

Re: How come print cannot be assigned to a variable?

2005-05-20 Thread Adriano Ferreira
print is a statement, not a function. Read Guido's words on that: http://www.python.org/search/hypermail/python-1992/0112.html Regards. Adriano. -- http://mail.python.org/mailman/listinfo/python-list

Re: Squezing in replacements into strings

2005-04-25 Thread Adriano Ferreira
As Peter Otten said, sub() is probably what you want. Try: --- import re def _ok(matchobject): # more complicated stuff happens here return 1 def _massage(word): return _ + word + _ def _massage_or_not(matchobj): if not

Re: Why does python class have not private methods? Will this never changed?

2005-04-19 Thread Adriano Ferreira
but why does it hava not private methods? Because it does not need them, ain't it? Private stuff always makes programming much easier. Does it? Sometimes contortion is needed to get rid of declarations that restrain access, for example, when writing tests. I think the point-of-view of Python is