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

biolord9 at gmail.com biolord9 at gmail.com
Wed Feb 19 17:29:32 CET 2014


On Tuesday, February 18, 2014 3:34:51 PM UTC-5, Jonno wrote:
> 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 suitable.
> 
> 
> 
> 
> I'm looking for help/suggestions how to architect a module (perhaps just a class).
> 
> There is an existing module I want to use which has a class we'll call Existing Class.
> 
> 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:
> 
> new_object.foo
> 
> 
> new_object.foo.bar
> 
> 
> new_object.foo.bar.baz
> 
> 
> 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()
> 
> calls
> 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.

===============
>BREAKING NEWS!
===============
NEW YORK TIMES, THRINAXODON, OHIO
=====================
>
THRINAXODON RECENTLY FOUND 3 HUMAN FOSSILS FROM DEVONIAN STRATA FROM GREENLAND, THE EVOLUTIONISTS HAVE NO BONES ABOUT.
>
ONE EVIL EVOLUTIONIST, BOB CASANOVA HAS ADMITTED THAT HUMAN EVOLUTION IS IN FREE-FALL.
>
RICHARD LEAKEY HAS DIED FROM A HEART ATTACK DUE TO THIS GROUND-BREAKING FIND THAT CONCLUSIVELY SHOWS THAT HUMANS HAVE ORIGINS IN THE DEVONIAN.
>
NOW, IF YOU PLEASE, I HAVE TO SUE THE SMITHSONIAN FOR YEARS OF CENSORSHIP.
>
======================================
EVIDENCE THAT HUMANS LIVED IN THE DEVONIAN:

https://groups.google.com/group/sci.bio.paleontology/browse_thread/thread/6f501c469c7af24f#

https://groups.google.com/group/sci.bio.paleontology/browse_thread/thread/3aad75c16afb0b82#



More information about the Python-list mailing list