DwBear75 a écrit :
I am considering using python as a replacement for a lot of bash
scripting that I have been doing. I would like to be as cross platform
as possible, writing scripts for both windows and linux. Are there any
guides are general rules of thumb on
1) keeping code os independant

<obvious>
Use os.path, avoid any os-specific module.
</obvious>

2) nifty lambda's or other things to create functions fit for the
environment

You don't need lambdas here.

import random
some_condition = random.choice((True, False))

if some_condition:
    def myfunc():
        print "myfunc for 'somecondition==True'"
else:
    def myfunc():
        print "myfunc for 'somecondition==False'"




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

Reply via email to