On Tue, Sep 17, 2013 at 05:32:58PM +0100, Jonathan Maw wrote:
On Tue, Sep 17, 2013 at 04:12:51PM +0100, Richard Maw wrote:
> Repo: git://git.baserock.org/baserock/baserock/morph.git
> Ref: baserock/richardmaw/S8511/refactor-status-v2
> SHA1: 601f39bca09fa52acadec3b908f29aecc241e868
> Land: origin/master
I've looked at the code and understood most of it (scary lambdas and
clever oneliners make it hard for me to spot problems by analysis)
The only lambdas were used with sorted() to sort by an attribute's value
instead of whatever the object's notion of ordering is.
operator.attrgetter('attribute') could be used instead of lambda x:
x.attribute, but I felt it was more readable to use a language feature
than an obscure library function.
Another solution would be to make the GitDirectory and
SystemBranchDirectory objects naturally sort by file path.
I suspect it's actually the generator expressions that are causing
confusion, which I can sympathise with, but I feel they are the most
concise way of expressing what I wanted to do.
I am however on a bit of a lazy evaluation and functional programming
binge, so I'm open to being told I've done it in an opaque way.