Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
comparing types
#1
my function gets 2 arguments, foo and bar. they need to be the same type. verifying this is pretty obvious:
if type(foo) is type(bar):
    ...
or should i use == instead of is? is this the right way to go (ignoring those who say i should only support one type)?
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
comparing types - by Skaperen - Jun-25-2020, 02:47 AM
RE: comparing types - by Gribouillis - Jun-25-2020, 10:45 AM
RE: comparing types - by Skaperen - Jun-26-2020, 01:08 AM
RE: comparing types - by Gribouillis - Jun-26-2020, 07:08 AM
RE: comparing types - by Skaperen - Jun-26-2020, 06:02 PM
RE: comparing types - by DeaD_EyE - Jun-26-2020, 07:39 AM

Forum Jump:

User Panel Messages

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