Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
gotcha
#9
(Feb-22-2017, 02:34 AM)ichabod801 Wrote: I don't know why everyone finds bools as ints so surprising. Did no one take discrete math?
I took discrete math twice, thank you very much. Still don't understand any of it.

Really though I can see an argument being made either way. I'm used to in the statically typed languages I used booleans not being numeric (Scala / Java). As for the other side...

(Feb-22-2017, 02:28 AM)Skaperen Wrote: i bet it could be argued:  it's a feature
Yes! Python is, by convention, duck typed. It's not just dynamically typed and you're not prohibited by the language from type-checking. If it walks like a duck and quacks like a duck, why do you care if it's really a duck or not? I could design an API that does care, but such designs are not considered Pythonic. Much like "it's better to ask forgiveness than permission" being preferable "look before you leap" - there are situations when either is preferable, the culture of the language is to prefer one, and go to the other only in extraordinary circumstances.
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