Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's a rule of thumb, not a mantra.

I suppose the hilarious way to argue it would be to say that there is an implicit "all other things being equal" in front of each of those.



Call it what you want; I'm not arguing it to be pedantic, I think it's a very practical approach. But if you prefer:

All other things being equal, I see no reason to write code that needlessly introduces potential bugs and maintainability issues by ignoring the rule of thumb that explicit trumps implicit.


It's an old argument. I don't have real strong feelings about it. I think there is enough code doing one or the other out there that the end result is to understand well the ramifications of both, so it ends up a matter of taste.

The documentation is pretty clear about it:

http://docs.python.org/release/3.3.4/library/stdtypes.html#t...

Which leads to this:

    >>> a=object()
    >>> bool(a)
    True
    >>>




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: