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 linux pyfile evaluates to python.exe

This seems to work as expected on my Ubuntu box.

Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, sys
>>> sys.platform
'linux2'
>>> pyfile = (sys.platform[:3] == 'win' and 'python.exe') or 'python'
>>> pyfile
'python'
>>>

What do you get for sys.platform when you run this code under linux?

-- 
Jerry
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to