[Python-ideas] Please reconsider the Boolean evaluation of midnight
Shai Berger
shai at platonix.com
Wed Mar 5 17:38:25 CET 2014
On Wednesday 05 March 2014 18:20:08 Chris Angelico wrote:
> On Thu, Mar 6, 2014 at 3:05 AM, Shai Berger <shai at platonix.com> wrote:
> > On Wednesday 05 March 2014 17:37:14 Paul Moore wrote:
> >> On 5 March 2014 15:19, Shai Berger <shai at platonix.com> wrote:
> >> > What, other than "bug", do you call behavior that isn't sensible?
> >>
> >> "Unfortunate".
> >
> > That's unfortunate. You miss a lot of bugs.
>
> A bug is something where behaviour differs from documentation or
> intent. Differing from expectation isn't necessarily a bug (although
> in the absence of clear docs or statement of intent, it could be
> called one), partly because expectations vary. When the bulk of
> programmers expect one thing and the code does another, it's probably
> a wart or misfeature, but if it's properly documented, it can't really
> be called a bug.
>
> In this case, I would say that it's a wart.
Fine. That is, I'm not too interested in the semantics of English, but rather
in the semantics of Python.
So, I rephrase my request: Would anybody object to a silent warning issued
whenever a time-object is evaluated as Boolean? Something along the lines of,
"Evaluating time object as Boolean: Note that time(0,0,0) evaluates to False"
A silent warning, IIUC, is only printed when requested -- so it won't get in
anybody's way, but still provide a tool for avoiding the bug. It can be added
into Python 3.5. It could probably be added to earlier versions, but for that
we'd need to consider this a bug :)
Shai.
More information about the Python-ideas
mailing list