Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
gotcha
#7
gotcha 2.0

so i update my tests and test for False and/or True like this:

if value == False:
    handle_false()
elif value == True:
    handle_true()
so what if value is 0 or 1?  oops!

i guess i need to do:

if isinstance(value,bool):
    if value == False:
        handle_false()
    elif value == True:
        handle_true()
i bet it could be argued:  it's a feature
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
gotcha - by Skaperen - Feb-21-2017, 09:14 AM
RE: gotcha - by Larz60+ - Feb-21-2017, 10:12 AM
RE: gotcha - by zivoni - Feb-21-2017, 10:46 AM
RE: gotcha - by micseydel - Feb-21-2017, 04:50 PM
RE: gotcha - by Ofnuts - Feb-21-2017, 09:30 PM
RE: gotcha - by micseydel - Feb-21-2017, 09:33 PM
gotcha 2.0 - by Skaperen - Feb-22-2017, 02:28 AM
RE: gotcha - by ichabod801 - Feb-22-2017, 02:34 AM
RE: gotcha - by Skaperen - Feb-22-2017, 05:16 AM
RE: gotcha - by micseydel - Feb-22-2017, 04:59 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020