Andrew Koenig wrote:
> "Lonnie Princehouse" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
> 
> 
>>If you try this sort of inheritance, I'd recommend writing down the
>>formal grammar before you start writing classes.  Don't try to define
>>the grammar through the inheritance hierarchy; it's too easy to
>>accidentally build a hierarchy that can't be translated into a
>>single-pass-parsable grammar...
> 
> 
> Understood.  I was using expression trees as a contrived example, and really 
> want to know about the Python community's stylistic preferences for defing 
> such hierarchies that don't absolutely need a root.

I have used empty or near-empty base classes to be some sort of
class 'tag' for the derived classes.
Much like Java's Serializable interface; it adds nothing on
a functional level but you can check if a class has a 'tag'
by checking if it is an instance of the base class.
I don't know if this is good style in Python but I tend
to use it sometimes (probably because I do Java at work ;-)

--Irmen
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to