[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help creating new module which inherits existing class from another module.

I'm not sure if this list is a suitable place to ask for this kind of help
so if it's not please just suggest another forum which might be more

I'm looking for help/suggestions how to architect a module (perhaps just a

There is an existing module I want to use which has a class we'll call

I want to create a python module which allows me to create *new_objects* with
the following properties:

   - The new_objects have all the attributes of the Existing_Class (simply
   create a class that inherits from Existing_Class)
   - I then want to create a nested structure under the new_objects
   something like:




Where foo, bar, baz have the following properties:

   - All have *docstrings*
   - All are available for *tab completion* tools upon new_object creation.

   Some of which will have *new methods* which act in the following way:
   - new_object.foo.bar()

   - new_object.existing_method("foo.bar", *args)

I believe I'll need to use metaclasses and have an idea that
types.MethodType will help but I keep getting stuck. Any pointers would be
greatly appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140218/10d91cac/attachment.html>