Exec inside a class method to call other class methods?

David Stanek dstanek at dstanek.com
Thu Dec 25 19:05:47 EST 2008


On Thu, Dec 25, 2008 at 6:22 PM, Matthew Dubins
<matt.dubins at sympatico.ca> wrote:
> Each type does contain its own parsing method.  It's just that, as it
> stands, one method is being used to shunt off the data to the correct
> parsing method.
>

Not really. You have all of the parsing methods in a single class. Is
it possible for each data class to have a parse method?

class DOB(object):
    def parse(...):
        pass

There are many pros and cons do this way of doing things. Google
polymorphism and possibly duck typing to see some interesting
discussions.

-- 
David
http://www.traceback.org



More information about the Python-list mailing list