The parentheses are there for a reason
2008/3/7, Steven D'Aprano <[EMAIL PROTECTED]>:
>
> On Fri, 07 Mar 2008 12:38:11 -0800, waltbrad wrote:
>
> > The script comes from Mark Lutz's Programming Python. It is the second
> > line of a script that will launch a python program on any platform.
> >
>
On Mar 8, 7:38 am, waltbrad <[EMAIL PROTECTED]> wrote:
> The script comes from Mark Lutz's Programming Python. It is the
> second line of a script that will launch a python program on any
> platform.
>
> import os, sys
> pyfile = (sys.platform[:3] == 'win' and 'python.exe') or 'python'
>
> Okay, r
On Fri, 07 Mar 2008 12:38:11 -0800, waltbrad wrote:
> The script comes from Mark Lutz's Programming Python. It is the second
> line of a script that will launch a python program on any platform.
>
> import os, sys
> pyfile = (sys.platform[:3] == 'win' and 'python.exe') or 'python'
>
> Okay, run
On Fri, Mar 7, 2008 at 2:38 PM, waltbrad <[EMAIL PROTECTED]> wrote:
> The script comes from Mark Lutz's Programming Python. It is the
> second line of a script that will launch a python program on any
> platform.
>
> import os, sys
> pyfile = (sys.platform[:3] == 'win' and 'python.exe') or 'py
> import os, sys
> pyfile = (sys.platform[:3] == 'win' and 'python.exe') or 'python'
>
> Okay, run on a win32 machine, pyfile evaluates to python.exe
[snip]
> Now. Run this on linux. The first condition evaluates sys.platform[:3]
> == 'win' as false.
[snip]
> Where am I going wrong. And when will
On Fri, Mar 7, 2008 at 3:38 PM, waltbrad <[EMAIL PROTECTED]> wrote:
> Now. Run this on linux. The first condition evaluates sys.platform[:3]
> == 'win' as false. So, the next comparison should be 'False' or
> 'python' -- This is because 'and' returns the first false value.
> But, again, on l
The script comes from Mark Lutz's Programming Python. It is the
second line of a script that will launch a python program on any
platform.
import os, sys
pyfile = (sys.platform[:3] == 'win' and 'python.exe') or 'python'
Okay, run on a win32 machine, pyfile evaluates to python.exe
That makes sen