Logically/Selectively Sub Class?

castironpi at gmail.com castironpi at gmail.com
Sun Mar 9 17:44:50 EDT 2008


On Mar 9, 4:28 pm, xkenneth <xkenn... at gmail.com> wrote:
> Might be a silly question, but is it possible to selectively subclass,
> IE subclass is a supporting module is present and not otherwise.
>
> Regards,
> Kenneth Miller

if mod is present:
   class Waypoint( Mine, Yours ): pass
else:
   class Waypoint( Mine ): pass

class NewClass( Waypoint ).

In 3.0, you can do

if mod is present:
   bases= Mine, Yours
else:
   bases= Mine,

class NewClass( *bases ).



More information about the Python-list mailing list