Instantiating sub-class from super

DL Neil PythonList at DancesWithMice.info
Fri Oct 18 18:37:28 EDT 2019


On 16/10/19 6:33 PM, Frank Millman wrote:
> On 2019-10-14 10:55 PM, DL Neil via Python-list wrote:
>> Is there a technique or pattern for taking a (partially-) populated 
>> instance of a class, and re-creating it as an instance of one of its 
>> sub-classes?

> Here is a link to an article entitled 'Understanding Hidden Subtypes'. 
> It dates back to 2004, but I think it is still relevant. It addresses 
> precisely the issues that you raise, but from a data-modelling 
> perspective, not a programming one.
> 
> http://tdan.com/understanding-hidden-subtypes/5193
> 
> I found it invaluable, and applied the concepts in my own 
> business/accounting application. Having created the ability to make 
> subtypes visible and explicit, I found all kinds of unexpected uses for 
> them.
> 
> The article seems to be missing a couple of images (Figure 1 and Figure 
> 2) showing the data relationships. I downloaded the original article 
> onto my computer years ago, and my local copy does have the images, so 
> if you would like to see them let me know and I will upload my version 
> somewhere to make it accessible.

Superb!

Yes please Frank - I've also approached it from the data/DB side, and 
thus presumably why I was puzzling over how one implements in Python.

(alternatively, email a PDF/similar directly)
-- 
Regards =dn



More information about the Python-list mailing list