How to easily toggle a Boolean property? I want to write a simple toggle for an existing UI Boolean property. Every time I run the following code Blender should either show or hide the name of the object in the Viewport, depending on the current state. It works fine, but I wondering if it is really necessary to to call the property 3 times for this easy task.

import bpy

obj = bpy.context.active_object

if obj.show_name == True:
    obj.show_name = False
else:
    obj.show_name = True 


Is there a more elegant way to write this?
This can trivially be done as:

obj.show_name = not obj.show_name


Which basically says: if True, make it not True (i.e. False), else if False, make it not False (i.e. True).