On Tue, Jun 4, 2013 at 11:44 AM, Rick Johnson
<rantingrickjohn...@gmail.com>wrote:

>
> This implicit conversion seems like a good idea at first,
> and i was caught up in the hype myself for some time: "Hey,
> i can save a few keystrokes, AWESOME!". However, i can tell
> you with certainty that this implicit conversion is folly.
> It is my firm belief that truth testing a value that is not
> a Boolean should raise an exception. If you want to convert
> a type to Boolean then pass it to the bool function:
>
>     lst = [1,2,3]
>     if bool(lst):
>         do_something
>
> This would be "explicit enough"


i
f lst:
    do_something

is equivalent to

if bool(lst):
   do_something

why not just have your editor autobool so you can spend more time coding
and less time stamping around?  That way the person that finds booled code
more readable can have what he wants and the people that find it less
readable can have what they want.

Win-win

BTW, you should do pointless comparisons like

if condition is True:
    do_something

rather than

if condition == True
    do_something
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to