Implicit conversion to boolean in if and while statements
alex23
wuwei23 at gmail.com
Sun Feb 10 21:38:39 EST 2013
On Feb 8, 4:29 pm, Rick Johnson <rantingrickjohn... at gmail.com> wrote:
> That's a strange thing to say when you go on to provide an example that tests the validity of the object "each and every time":
Here's a tip: context is important. I was referring to not having to
*explicitly* test if a label *is defined* in order to be able to use
it, which is something you need to do in other languages, such as
Javascript:
var func = function() { throw EventException; }
a = func()
if ( a == '1') ... // this raises a ReferenceError as 'a' is not
defined
if ( typeof a !== 'undefined' && a == '1')... // this guards
against the ReferenceError
> And i find it to be incredibly asinine.
I find your smugness to be much the same.
> Consider this:
> if connect("my:db") as db:
> <do something>
>
> No need to make a call and then test for the validity of the call when you can do both simultaneously AND intuitively.
No need to learn a language when you can just make crap up and whine
when it doesn't work.
> *school-bell-rings*
You're "schooling" others using a hypothetical variant of an existing
language which you believe should conform to your a priori assumptions
about how such a language should work? You're "schooling" people who
_read the documentation_ when you admit to not doing so yourself?
You're not asinine, you're just an asshole.
More information about the Python-list
mailing list