Re: Is this a legal / acceptable statement ?

2006-05-05 Thread Philippe Martin
Fredrik Lundh wrote: > Philippe Martin wrote: > >> l_init really is a boolean parameter and l_value a value that _might_ >> exist in a shelve. >> >> So I just want to have a parameter to a method so if the first value >> tested is false (l_init) then the second (l_value) does not get tested >> ..

Re: Is this a legal / acceptable statement ?

2006-05-05 Thread Philippe Martin
bruno at modulix wrote: > Philippe Martin wrote: >> bruno at modulix wrote: >> >> >>>Philippe Martin wrote: >>>(snip) >>> l_init really is a boolean parameter and l_value a value that _might_ exist in a shelve. So I just want to have a parameter to a method so if the first value

Re: Is this a legal / acceptable statement ?

2006-05-05 Thread bruno at modulix
Philippe Martin wrote: > bruno at modulix wrote: > > >>Philippe Martin wrote: >>(snip) >> >>>l_init really is a boolean parameter and l_value a value that _might_ >>>exist in a shelve. >>> >>>So I just want to have a parameter to a method so if the first value >>>tested is false (l_init) then the

Re: Is this a legal / acceptable statement ?

2006-05-05 Thread Philippe Martin
bruno at modulix wrote: > Philippe Martin wrote: > (snip) >> >> l_init really is a boolean parameter and l_value a value that _might_ >> exist in a shelve. >> >> So I just want to have a parameter to a method so if the first value >> tested is false (l_init) then the second (l_value) does not ge

Re: Is this a legal / acceptable statement ?

2006-05-05 Thread Martin Blume
"Philippe Martin" schrieb > Hi, > > This code works, but is it "appropriate" ? > > l_init = False > > if True == l_init and 1234 = l_value: > print 'l_value is initialized' > > I know I can do this with a try but ... > I am a Python newbie, but I think working with l_value = None would be t

Re: Is this a legal / acceptable statement ?

2006-05-05 Thread Fredrik Lundh
Philippe Martin wrote: > l_init really is a boolean parameter and l_value a value that _might_ exist > in a shelve. > > So I just want to have a parameter to a method so if the first value tested > is false (l_init) then the second (l_value) does not get tested ... because > it is the second in th

Re: Is this a legal / acceptable statement ?

2006-05-05 Thread bruno at modulix
Philippe Martin wrote: (snip) > > l_init really is a boolean parameter and l_value a value that _might_ exist > in a shelve. > > So I just want to have a parameter to a method so if the first value tested > is false (l_init) then the second (l_value) does not get tested ... because > it is the se

Re: Is this a legal / acceptable statement ?

2006-05-05 Thread bruno at modulix
Philippe Martin wrote: > Hi, > > This code works, but is it "appropriate" ? appropriate for what ?-) > l_init = False > # corrected typo, cf other post in this thread > if True == l_init and 1234 == l_value: > print 'l_value is initialized' Do this in production code, and have one of the first

Re: Is this a legal / acceptable statement ?

2006-05-05 Thread Philippe Martin
Larry Bates wrote: > Philippe Martin wrote: >> Hi, >> >> This code works, but is it "appropriate" ? >> >> l_init = False >> >> if True == l_init and 1234 = l_value: >> print 'l_value is initialized' >> >> I know I can do this with a try but ... >> >> Philippe >> >> > 1) You have a syntax

Re: Is this a legal / acceptable statement ?

2006-05-05 Thread Larry Bates
Philippe Martin wrote: > Hi, > > This code works, but is it "appropriate" ? > > l_init = False > > if True == l_init and 1234 = l_value: > print 'l_value is initialized' > > I know I can do this with a try but ... > > Philippe > > 1) You have a syntax error 1234 == l_value (note ==) 2) This

Re: Is this a legal / acceptable statement ?

2006-05-05 Thread Philippe Martin
I'm sorry (typo): l_init = False if True == l_init and 1234 == l_value: print 'l_value is initialized' Note that 1234 == l_value does not get evaluated. Philippe vbgunz wrote: > you don't have to say: > > if True == l_init > > it is suggested you simply say: > > if l_init: > > Reme

Re: Is this a legal / acceptable statement ?

2006-05-05 Thread vbgunz
you don't have to say: if True == l_init it is suggested you simply say: if l_init: Remember the and operator requires expressions on both sides to be true to continue. If you notice, your expression on the right side of the 'and' is an assignment and so this is forbidden (SyntaxError). assignm

Is this a legal / acceptable statement ?

2006-05-05 Thread Philippe Martin
Hi, This code works, but is it "appropriate" ? l_init = False if True == l_init and 1234 = l_value: print 'l_value is initialized' I know I can do this with a try but ... Philippe -- http://mail.python.org/mailman/listinfo/python-list