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 >>>>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 '[EMAIL PROTECTED]'.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. > > Then reads Fredrik's answer and this: > ''' > Help on module shelve: > > (...) > > DESCRIPTION > A "shelf" is a persistent, dictionary-like object. > (...) > """ > > What about : > > if shelf.has_key('l_value'): > ... > > ?-) > > -- > bruno desthuilliers > python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for > p in '[EMAIL PROTECTED]'.split('@')])"
Yes that would make sense. Philippe -- http://mail.python.org/mailman/listinfo/python-list