Is this a legal / acceptable statement ?

Philippe Martin pmartin at snakecard.com
Fri May 5 11:22:39 EDT 2006


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 get tested
>> ... because it is the second in the statement and only seems to get
>> evaluated if the first one is true.
> 
> s/seems to get/is/
> 
> But this is a really unpythonic way to do things IMHO. Either use a
> try/except block (probably the most straightforward solution), or, as in
> Larry's post, test for the existence of 'l_value' in locals().
> 
> My 2 cents...
> --
> bruno desthuilliers
> python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
> p in 'onurb at xiludom.gro'.split('@')])"

Well, that was the question - I wanted to avoid that because I'm already in
a try/except and do not like to imbricate them too much.

Philippe





More information about the Python-list mailing list