
Sept. 29, 2015
6:07 p.m.
On 09/29/2015 12:04 PM, Brian O'Neill wrote:
A further virtue of
self.vertices = vertices or []
and the like is that they coerce falsy parameters of the wrong type to the falsy object of the correct type.
E.g. if vertices is '' or 0, self.vertices will be set to [], whereas the ternary expression only tests
for not-None so self.vertices will be set to a probably crazy value.
Doesn't seem like a virtue to me, seems like it's probably hiding a bug in the calling code, which may have other ramifications. Better to have the "crazy value" visible and fail faster, so you can go fix that bug. Carl