Python class structure ... prep() method?
<p>We have a metaclass, a class, and a child class for an alert system:</p>

<pre><code>class AlertMeta(type):
"""
Metaclass for all alerts    
Reads attrs and organizes AlertMessageType data
"""
def __new__(cls, base, name, attrs):
    new_class = super(AlertMeta, cls).__new__(cls, base, name, attrs)
    # do stuff to new_class
    return new_class

class BaseAlert(object):
"""
BaseAlert objects should be instantiated
in order to create new AlertItems.
Alert objects have classmethods for dequeue (to batch AlertItems)
and register (for associated a user to an AlertType and AlertMessageType)

If the __init__ function recieves 'dequeue=True' as a kwarg, then all other
arguments will be ignored and the Alert will check for messages to send
"""

__metaclass__ = AlertMeta

def __init__(self, **kwargs):
    dequeue = kwargs.pop('dequeue',None)
    if kwargs:
        raise ValueError('Unexpected keyword arguments: %s' % kwargs)
    if dequeue:
        self.dequeue()
    else:
        # Do Normal init stuff

def dequeue(self):
    """
    Pop batched AlertItems
    """
    # Dequeue from a custom queue

class CustomAlert(BaseAlert):
    def __init__(self,**kwargs):
        # prepare custom init data
        super(BaseAlert, self).__init__(**kwargs)
</code></pre>

<p>We would like to be able to make child classes of BaseAlert (CustomAlert) that allow us to run dequeue and to be able to run their own <code>__init__</code> code.  We think there are three ways to do this:</p>

<ol>
<li>Add a prep() method that returns True in the BaseAlert and is called by <code>__init__</code>.  Child classes could define their own prep() methods.</li>
<li>Make dequeue() a class method - however, alot of what dequeue() does requires non-class methods - so we'd have to make those class methods as well.</li>
<li>Create a new class for dealing with the queue.  Would this class extend BaseAlert?</li>
</ol>

<p>Is there a standard way of handling this type of situation?</p>
