Re: Instantiating sub-class from super

2019-10-24 Thread DL Neil via Python-list
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: Instantiating sub-class from super

2019-10-24 Thread Frank Millman
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

Re: Instantiating sub-class from super

2019-10-19 Thread duncan smith
On 18/10/2019 23:57, DL Neil wrote: > On 17/10/19 7:52 AM, MRAB wrote: >> On 2019-10-16 19:43, duncan smith wrote: >>> On 16/10/2019 04:41, DL Neil wrote: On 16/10/19 1:55 PM, duncan smith wrote: > On 15/10/2019 21:36, DL Neil wrote: >> On 16/10/19 12:38 AM, Rhodri James wrote:

Re: Instantiating sub-class from super

2019-10-18 Thread DL Neil via Python-list
On 18/10/19 9:27 AM, Eryk Sun wrote: On 10/17/19, MRAB wrote: On 2019-10-17 20:06, Eryk Sun wrote: I'm bugged by how the article mis-characterizes the fundamental problem. The operating system has nothing to do with the order of a directory listing, which varies even with an OS, depending on

Re: Instantiating sub-class from super

2019-10-18 Thread DL Neil via Python-list
On 17/10/19 7:52 AM, MRAB wrote: On 2019-10-16 19:43, duncan smith wrote: On 16/10/2019 04:41, DL Neil wrote: On 16/10/19 1:55 PM, duncan smith wrote: On 15/10/2019 21:36, DL Neil wrote: On 16/10/19 12:38 AM, Rhodri James wrote: On 14/10/2019 21:55, DL Neil via Python-list wrote: ... So,

Re: Instantiating sub-class from super

2019-10-18 Thread DL Neil via Python-list
On 17/10/19 4:08 AM, Piet van Oostrum wrote: DL Neil writes: That said, if a "trans" person has ovaries or testes (for example) then a non-traditional sexual identification is irrelevant - for medical purposes. Diseases in those areas (and now I'm a long way from a research questionnaire and

Re: Instantiating sub-class from super

2019-10-18 Thread DL Neil via Python-list
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

Re: Instantiating sub-class from super

2019-10-17 Thread Eryk Sun
On 10/17/19, MRAB wrote: > On 2019-10-17 20:06, Eryk Sun wrote: > >> I'm bugged by how the article mis-characterizes the fundamental >> problem. The operating system has nothing to do with the order of a >> directory listing, which varies even with an OS, depending on the file >> system. The

Re: Instantiating sub-class from super

2019-10-17 Thread MRAB
On 2019-10-17 20:06, Eryk Sun wrote: On 10/17/19, Dennis Lee Bieber wrote: On Wed, 16 Oct 2019 19:52:50 +0100, MRAB declaimed the following: Researchers find bug in Python script may have affected hundreds of studies

Re: Instantiating sub-class from super

2019-10-17 Thread Eryk Sun
On 10/17/19, Dennis Lee Bieber wrote: > On Wed, 16 Oct 2019 19:52:50 +0100, MRAB > declaimed the following: > >>Researchers find bug in Python script may have affected hundreds of >> studies

Re: Instantiating sub-class from super

2019-10-17 Thread Frank Millman
On 2019-10-16 7:33 AM, Frank Millman wrote: 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.

Re: Instantiating sub-class from super

2019-10-16 Thread duncan smith
On 16/10/2019 19:52, MRAB wrote: > On 2019-10-16 19:43, duncan smith wrote: >> On 16/10/2019 04:41, DL Neil wrote: >>> On 16/10/19 1:55 PM, duncan smith wrote: On 15/10/2019 21:36, DL Neil wrote: > On 16/10/19 12:38 AM, Rhodri James wrote: >> On 14/10/2019 21:55, DL Neil via

Re: Instantiating sub-class from super

2019-10-16 Thread Barry Scott
> On 14 Oct 2019, at 21:55, 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? The pattern I know is to use a factory function to choose between a

Re: Instantiating sub-class from super

2019-10-16 Thread MRAB
On 2019-10-16 19:43, duncan smith wrote: On 16/10/2019 04:41, DL Neil wrote: On 16/10/19 1:55 PM, duncan smith wrote: On 15/10/2019 21:36, DL Neil wrote: On 16/10/19 12:38 AM, Rhodri James wrote: On 14/10/2019 21:55, DL Neil via Python-list wrote: ... So, yes, the "label" is unimportant -

Re: Instantiating sub-class from super

2019-10-16 Thread duncan smith
On 16/10/2019 04:41, DL Neil wrote: > On 16/10/19 1:55 PM, duncan smith wrote: >> On 15/10/2019 21:36, DL Neil wrote: >>> On 16/10/19 12:38 AM, Rhodri James wrote: On 14/10/2019 21:55, DL Neil via Python-list wrote: >>> ... >>> So, yes, the "label" is unimportant - except to politicians and

Re: Instantiating sub-class from super

2019-10-16 Thread Piet van Oostrum
DL Neil writes: > That said, if a "trans" person has ovaries or testes (for example) then > a non-traditional sexual identification is irrelevant - for medical > purposes. Diseases in those areas (and now I'm a long way from a > research questionnaire and from Python - but this is roughly how it

Re: Instantiating sub-class from super

2019-10-15 Thread Frank Millman
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? In a medically-oriented situation, we have a Person() class, and start collecting

Re: Instantiating sub-class from super

2019-10-15 Thread DL Neil via Python-list
On 16/10/19 1:55 PM, duncan smith wrote: On 15/10/2019 21:36, DL Neil wrote: On 16/10/19 12:38 AM, Rhodri James wrote: On 14/10/2019 21:55, DL Neil via Python-list wrote: ... So, yes, the "label" is unimportant - except to politicians and statisticians, who want precise answers from vague

Re: Instantiating sub-class from super

2019-10-15 Thread duncan smith
On 15/10/2019 21:36, DL Neil wrote: > On 16/10/19 12:38 AM, Rhodri James wrote: >> On 14/10/2019 21:55, DL Neil via Python-list wrote: > ... > >>> It seemed better (at the design-level) to have Man( Person ) and >>> Woman( Person ) sub-classes to contain the pertinent attributes, >>> source more

Re: Instantiating sub-class from super

2019-10-15 Thread DL Neil via Python-list
On 16/10/19 12:38 AM, Rhodri James wrote: On 14/10/2019 21:55, DL Neil via Python-list wrote: ... It seemed better (at the design-level) to have Man( Person ) and Woman( Person ) sub-classes to contain the pertinent attributes, source more detailed and specific questions, and collect such

Re: Instantiating sub-class from super

2019-10-15 Thread Rhodri James
On 14/10/2019 21:55, 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? In a medically-oriented situation, we have a Person() class, and start collecting

Re: Instantiating sub-class from super

2019-10-14 Thread DL Neil via Python-list
Hi Greg, On 15/10/19 11:37 AM, Gregory Ewing wrote: DL Neil 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? Often you can assign to the __class__ attribute of an instance to change

Re: Instantiating sub-class from super

2019-10-14 Thread Gregory Ewing
DL Neil 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? Often you can assign to the __class__ attribute of an instance to change its class. Python 3.7.3 (default, Apr 8 2019,