Re: [ANNOUNCE]: PyGit and libgit-thin
- From
David Kastrup <dak@gnu.org>
- Date
- Jul 25, 2007, 19:57 UTC
- Message-ID
- <85odi08ddk.fsf@lola.goethe.zz>
- In-Reply-To
- <20070725195010.GA30277@nan92-1-81-57-214-146.fbx.proxad.net>
Yann Dirson <ydirson@altern.org> writes:
Show 28 quoted lines
> I had a quick look at the current pygit API (as described in the
> README), and I find the current revlist one somewhat confusing. Why
> using post-contructor methods, and not using named args in the
> constructor itself ?
>
> That is, the example reading:
>
>>>> rv = repo.revlist()
>>>> rv.include('8d9107e8c50e1c4ff43c91c8841805833f3ecfb9')
>>>> rv.count = 10
>>>> rv.show_merges()
>>>> for commit in rv:
> ... print commit.id()
> ...
>
>
> would be IMHO much nicer to use as:
>
>>>> rv = repo.revlist(include=('8d9107e8c50e1c4ff43c91c8841805833f3ecfb9'),
> ... count = 10,
> ... show_merges = true)
> ...
>>>> for commit in rv:
> ... print commit.id()
> ...
>
>
> What do you think ?Nicer to use if the commands and their options originate from withing Python. But if Python parses arguments from somewhere else and passes them on, the former interface leads to much cleaner code AFAICS. Pasting together a named argument call piecemeal is not going to be pretty, I should think.
-- David Kastrup, Kriemhildstr. 15, 44793 Bochum