On Wed, May 5, 2021 at 10:15 PM Chris Johns <chr...@rtems.org> wrote: > > On 6/5/21 4:49 am, Gedare Bloom wrote: > > On Wed, May 5, 2021 at 9:16 AM Alex White <alex.wh...@oarcorp.com> wrote: > >> > >> On Wed, May 5, 2021 at 9:47 AM Gedare Bloom <ged...@rtems.org> wrote: > >>> > >>> Why? > >> > >> To prevent the '--mail' and '--use-gitconfig' options from being added > >> more than once to the ArgumentParser in add_arguments. > >> > > How does that happen? > > > > I'm not trying to be frustrating (just annoying). I want to be sure > > we're using the right solution for the right problem, and not just > > putting a bandaid over something so it works while we hide some > > underlying concerns.
It happened because I did not know about the lack of a dictionary key ordering guarantee in Python (at least before 3.6 I believe) and because I forgot to update the start index for iterating the keys. I will take Chris's approach below. > > Gedare, I am agree. I think there maybe another simpler solution. > > Why not make the list() be something like ... > > no_add = ['--mail', '--use-gitconfig'] > for o in [opt for opt in list(_options) if not in no_add]: > .. > > ... or something like that? This seems more reliable as it avoids the magic number in the loop and should avoid introducing problems like this in the future. I'll get a v2 out with this added. Thanks, Alex > > Chris > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel