Instantiating sub-class from super

DL Neil PythonList at DancesWithMice.info
Fri Oct 25 01:38:08 EDT 2019


On 25/10/19 4:29 AM, Frank Millman wrote:
> On 2019年10月19日 12:37 AM, DL Neil via Python-list wrote:
>> 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)
>> Hi
>> I have just got back from a few days break and have only seen your 
> message now.
>> Did you see the message I posted on the 17th with a download link? If 
> not, would you like me to post it again?

I did spot the later post - but only after I'd written the above.
I've been amused by the similarities between their case and ours, and 
enjoyed learning a lesson (or two?).
Thanks and apologies.
-- 
Regards =dn


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /