On 2007-09-10, Chris Mellon <[EMAIL PROTECTED]> wrote: > On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> Agreed; but I prefer 'if y[0] == ""', absent more context and >> better names. > > Probably should use u"" if you're going to take that route, as > this will fail spuriously if y[0] contains a unicode string > that can't be implicitly converted to ascii. Personally, I > prefer the boolean check and I'll let operations fail elsewhere > if there's a type mismatch.
I have a quibble not with the functionality of the boolean check, but with its expressiveness. if y[0] == "" expresses more, i.e., that I expect y[0] to contain a Python byte string. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list