Which of two variants of code is better?

Victor Porton porton at narod.ru
Mon Nov 21 12:48:10 EST 2016


Which of two variants of code to construct an "issue comment" object (about 
BitBucket issue comments) is better?

1.

obj = IssueComment(Issue(IssueGroup(repository, 'issues'), id1), id2)

or

2.

list = [('issues', IssueGroup), (id1, Issue), (id2, IssueComment)]
obj = construct_subobject(repository, list)

(`construct_subobject` is to be defined in such as way that "1" and "2" do 
the same.)

Would you advise me to make such function construct_subobject function or 
just to use the direct coding as in "1"?

-- 
Victor Porton - http://portonvictor.org



More information about the Python-list mailing list