Re: I cannot evaluate this statement...

2008-03-07 Thread Michael Wieher
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. > > >

Re: I cannot evaluate this statement...

2008-03-07 Thread John Machin
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

Re: I cannot evaluate this statement...

2008-03-07 Thread Steven D'Aprano
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

Re: I cannot evaluate this statement...

2008-03-07 Thread Chris Mellon
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

Re: I cannot evaluate this statement...

2008-03-07 Thread Tim Chase
> 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

Re: I cannot evaluate this statement...

2008-03-07 Thread Jerry Hill
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

I cannot evaluate this statement...

2008-03-07 Thread waltbrad
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