[Svnmerge] Long argument processing of OptBase
Daniel Rall
dlr at collab.net
Tue Mar 28 13:08:39 PST 2006
On Tue, 28 Mar 2006, Giovanni Bajo wrote:
> Daniel Rall <dlr at collab.net> wrote:
>
> > OptBase's constructor contains the following, undocumented code:
> >
> > self.dest = self.lflags[0][2:].replace("-", "_")
> >
> > Why does it do this?
>
> In a first iteration (never committed), the value of the options from the
> command line were being put as attributes of an object (instead of being
> keys of a dictionary), just like the standard Python optparse module does.
> In that case, you'd end up with opts.record_only (instead of
> opts["record-only"]).
Okay, thanks for the explanation, Giovanni.
> It's a leftover. I don't think there's value in keeping such a replace()
> right now, so you can throw it away. I can reinstate it if I ever want to
> change from opts["name"] to opts.name.
I committed a patch removing the replace in r19068. But, which style
would you really prefer? Manipulating the option object's __dict__ to
add the instance fields seems simple enough, and using those instance
fields on the options object instead of treating it as a dictionary is
quite feasible, too.
--
Daniel Rall
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : /pipermail/svnmerge/attachments/20060328/ec0582cc/attachment.pgp
More information about the Svnmerge
mailing list