Why does Grease Pencil ui not inherit from bpy.types.Panel? I am developing an addon and often right click on existing ui elements and select "Edit Source" to learn how certain ui elements were made. Almost every ui element inherits from bpy.types.Panel as expected and as I thought was necessary to make a ui panel.

I'm trying to make a similar panel to the Grease Pencil panel, and upon inspecting it's source, the panel's class is not inheriting from anything:

class GreasePencilDataPanel:
    # subclass must set
    # bl_space_type = 'IMAGE_EDITOR'
    bl_label = "Grease Pencil Layers"
    bl_region_type = 'UI'

    @staticmethod
    def draw_header(self, context):
        self.layout.prop(context.space_data, "show_grease_pencil", text="")

    @staticmethod
    def draw(self, context):
        layout = self.layout
        # Rest of class ...


Yet somehow it's still accessing attributes such as draw() and layout, which I thought were inherited attributes from bpy.types.Panel.

I've attempted to figure out why this works by making changes in the code, rerunning it, and seeing what changes occur in Blender. Strangely, no changes would take place when I made changes to the python code, unlike most python source code, which will reflect changes right away.

Why does this class not inherit from bpy.types.Panel, and what advantages/disadvantages does this bring?
Generic Grease Pencil Panel Classes

The code you have pasted is from properties_grease_pencil_common.py you will notice that none of the "panel" classes, eg GreasePencilDataPanelare registered.  These classes are defined separately and imported, since a lot of grease pencil functionality is generic.

Now if we look at the 3d view space space_view3d.py for example, notice it imports these classes

from .properties_grease_pencil_common import (
    GreasePencilDataPanel,
    GreasePencilPaletteColorPanel,
)


One of the panels defined in this space

class VIEW3D_PT_grease_pencil(GreasePencilDataPanel, Panel):
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'

    # NOTE: this is just a wrapper around the generic GP Panel


which inherits from bpy.types.Panel and is registered, and hence view-able as a panel in the 3D view space.