On Mon, Oct 3, 2011 at 14:06, Mark Dickinson dickinsm@gmail.com wrote:
But the two versions you give aren't equivalent. With:
pv = float(ln['PV']) if ln['PV'] else None
we'll get a ValueError if ln['PV'] contains some non-float, non-empty garbage value. With:
pv = float(ln['PV'], default=None)
and (IIUC) the proposed semantics, that garbage value will be turned into None instead, which is definitely not what I'd want to happen in normal usage.
Yeah, I guess you're right, and I'd definitely not want unexpected garbage values to go unnoticed.
Cheers,
Dirkjan