On Fri 2003-02-21 at 20:52:59 -0800, Greg Stein wrote:
> On Sat, Feb 22, 2003 at 05:29:40AM +0100, Branko Cibej wrote:
> > Greg Stein wrote:
> > >Yikes. If some code does sys.exit(1), then you're transforming that into a
> > >sys.exit(0). Not good.
> > >
> > I took your suggestion and massaged it into r5014. What do you think?
> This line:
> + print ('PASS: ', 'FAIL: ')[ex.code != 0],
> eek! :-)
> Actually, there has been some discussion of adding a ternary operator to
> Python. oy...
> Note the Python Fu Master way to write the above:
> print ex.code and 'FAIL' or 'PASS'
Hmmmm. Style issues aside, as someone who did never program Python,
but only looked at it, I had no problem to parse the Brane's array
trick, but I wouldn't have known what your line does.
Or more precisly: I was able to guess what it is meant to do (the
strings FAIL and PASS in a print statement are quite telling), but
would expect a flawed output. In other words: either it has a bug
(unprobable) or it expects too much Python knowledge from the
Real Fu Masters write code that is tricky and easy to read. ;)
Benjamin, with a broad grin.
Received on Sat Feb 22 06:22:32 2003
- application/pgp-signature attachment: stored