Python Forum
Question about types and py2 to py3 diffrences
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about types and py2 to py3 diffrences
#5
You can say:
if speed:
      speed = self.data.speed
None, an empty list, tuple, dict, set, string, etc., zero ( 0 ) and False are evaluated to False.

>>> for element in [None, [], {}, "", tuple(), set(), 0, False]:
...     print(bool(element))
... 
False
False
False
False
False
False
False
False
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
RE: Question about types and py2 to py3 diffrences - by wavic - Jun-22-2018, 07:26 PM

Forum Jump:

User Panel Messages

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