Re: Stylistic question regarding no-op code and tests

2015-10-15 Thread Jason Swails
On Wed, Oct 14, 2015 at 10:07 PM, Ben Finney wrote: > Jason Swails writes: > > > What I recently realized, though, that what this construct allows is > > for the coverage testing package (which I have recently started > > employing for my project... thanks Ned and others!) to detect whether > >

Re: Stylistic question regarding no-op code and tests

2015-10-15 Thread Peter Otten
Jason Swails wrote: > Hi everyone, > > I'd like to get some opinions about some coding constructs that may seem > at first glance to serve no purpose, but does have *some* non-negligible > purpose, and I think I've come to the right place :). > > The construct is this: > > def my_function(arg1,

Re: Stylistic question regarding no-op code and tests

2015-10-14 Thread Ben Finney
Jason Swails writes: > What I recently realized, though, that what this construct allows is > for the coverage testing package (which I have recently started > employing for my project... thanks Ned and others!) to detect whether > or not both code paths are covered in the test suite. Coverage.p

Re: Stylistic question regarding no-op code and tests

2015-10-14 Thread Chris Angelico
On Thu, Oct 15, 2015 at 12:49 PM, Jason Swails wrote: > My question is, what do you think of the "else: pass" statement? It is a > complete no-op and is syntactically equivalent to the same code with those > lines removed. Up until earlier today, I would look at that and cringe (I > still do, a

Stylistic question regarding no-op code and tests

2015-10-14 Thread Jason Swails
Hi everyone, I'd like to get some opinions about some coding constructs that may seem at first glance to serve no purpose, but does have *some* non-negligible purpose, and I think I've come to the right place :). The construct is this: def my_function(arg1, arg2, filename=None): """ Some fun