Re: [ANNOUNCE]: PyGit and libgit-thin

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [ANNOUNCE]: PyGit and libgit-thin

From: David Kastrup <hidden>
Date: 2016-06-15 22:43:23

Yann Dirson [off-list ref] writes:
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:
quoted
quoted
quoted
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:
quoted
quoted
quoted
rv = repo.revlist(include=('8d9107e8c50e1c4ff43c91c8841805833f3ecfb9'),
...                   count = 10,
...                   show_merges = true)
...
quoted
quoted
quoted
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

Re: [ANNOUNCE]: PyGit and libgit-thin

From: Jan Hudec <hidden>
Date: 2016-06-15 22:43:24

On Wed, Jul 25, 2007 at 21:57:59 +0200, David Kastrup wrote:
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.
You just put all the arguments in a dict and use the ** syntax. And if you
already get the arguments in a dict from the parser, it's even nicer.

-- 
						 Jan 'Bulb' Hudec [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help