[PATCH 1 of 5] resolve: accepts walkopts (-I and -X)

Simon Heimberg simohe at besonet.ch
Wed Aug 6 16:37:08 CDT 2008


The following line works too. Would this be beater?
    if len([x for x in opts if opts[x] in 
            ['list', 'mark', 'unmark'] ]) > 1:
Or is this one preferred?
    if len(set(['list', 'mark', 'unmark']) & set(opts)) > 1:

Brendan Cully thought me that "1 == True" returns True. This could be a
problem in the feature. "opts[s] is True" would avoid this. But now I
prefer an explicit list of the exclusive arguments. Do you agree?

I will resend the patch series later, when all errors are reported.  :-)

Greetings
simohe

Am Mittwoch, den 06.08.2008, 23:07 +0200 schrieb Martin Geisler:
> Simon Heimberg <simohe at besonet.ch> writes:
> 
> > Oo 2008-08-06 at 22:50 +0200, Martin Geisler wrote:
> >
> >> It should not be necessary to write "if foo == True", since writing
> >> "if foo" is equivalent.
> >
> > No, it is not. if foo is not boolean (example: foo="string") then
> > "foo == True" returns false. Like this I only count the options
> > without arguments (-I and -X are skipped).
> 
> I'm not at all familiar with the code, so you migth be right. It just
> looked like a typical mistake to my eyes :-)



More information about the Mercurial-devel mailing list