inheritance?

infidel saint.infidel at gmail.com
Wed Aug 16 12:12:04 EDT 2006


> Yes I believe so but in fromfile I want to call the appropriate
> method depending on the in a parameter in fromfile...
> like:
> class baseClass:
>    def fromfile(self, fileObj, byteOrder=None, explicit=False):
>       if explicit:
>          call fromfile of explicit class
>       else:
>         call fromfile of implicit class

class baseClass:
    def fromfile(self, fileObj, **kwargs):
        raise NotImplementedError()

class implicitClass:
    def fromfile(self, fileObj, **kwargs):
        byteOrder = kwargs.get('byteOrder', None)
        # do something

class explicitClass:
    def fromfile(self, fileObj, **kwargs):
        # do something




More information about the Python-list mailing list