On Thu, 19 Jan 2017 09:02 am, Ethan Furman wrote:
[...]
> One problem with the above is existing instances won't be modified to
> inherit from the updated class. I am unsure if that is solvable before
> 3.6, but in 3.6 one can use the new __init_subclass__ to avoid a Final
> base class, a FinalMe
On 01/18/2017 08:24 AM, Ethan Furman wrote:
On 01/17/2017 11:05 PM, Steven D'Aprano wrote:
I've given a metaclass that disallows subclassing:
class MyClass(MyParent, metaclass=FinalMeta):
...
Ethan took that one step further by giving a class you inherit from to disallow
subclassing:
On 01/17/2017 11:05 PM, Steven D'Aprano wrote:
I've given a metaclass that disallows subclassing:
class MyClass(MyParent, metaclass=FinalMeta):
...
Ethan took that one step further by giving a class you inherit from to disallow
subclassing:
class MyClass(MyParent, Final):
...
Cou
On Wed, 18 Jan 2017 13:10:41 +1100, Steven D'Aprano wrote:
> On Tuesday 17 January 2017 20:37, Antoon Pardon wrote:
>
>> Op 17-01-17 om 08:05 schreef Steven D'Aprano:
>>> I wish to emulate a "final" class using Python, similar to bool:
>>>
>>> py> class MyBool(bool):
>>> ... pass ...
>>> Trac
On Wednesday 18 January 2017 15:42, Ethan Furman wrote:
[...]
> Both those cases are good candidates for disallowing subclassing.
I've given a metaclass that disallows subclassing:
class MyClass(MyParent, metaclass=FinalMeta):
...
Ethan took that one step further by giving a class you inhe
On 01/17/2017 01:37 AM, Antoon Pardon wrote:
Op 17-01-17 om 08:05 schreef Steven D'Aprano:
I wish to emulate a "final" class using Python, similar to bool:
py> class MyBool(bool):
... pass
...
Traceback (most recent call last):
File "", line 1, in
TypeError: type 'bool' is not an acce
On Tuesday 17 January 2017 20:37, Antoon Pardon wrote:
> Op 17-01-17 om 08:05 schreef Steven D'Aprano:
>> I wish to emulate a "final" class using Python, similar to bool:
>>
>> py> class MyBool(bool):
>> ... pass
>> ...
>> Traceback (most recent call last):
>> File "", line 1, in
>> TypeErr
On Wed, 18 Jan 2017 06:14 am, Ethan Furman wrote:
> On 01/16/2017 11:32 PM, Steven D'Aprano wrote:
>> On Tuesday 17 January 2017 18:05, Steven D'Aprano wrote:
>>
>>> I wish to emulate a "final" class using Python, similar to bool:
>>
>> I may have a solution: here's a singleton (so more like None
On Tue, 17 Jan 2017 08:54 pm, Erik wrote:
> Hi Steven,
>
> On 17/01/17 07:05, Steven D'Aprano wrote:
>> I wish to emulate a "final" class using Python, similar to bool:
>
> [snip]
>
>> It doesn't have to be absolutely bulletproof, but anyone wanting to
>> subclass my class should need to work f
On 01/16/2017 11:32 PM, Steven D'Aprano wrote:
On Tuesday 17 January 2017 18:05, Steven D'Aprano wrote:
I wish to emulate a "final" class using Python, similar to bool:
I may have a solution: here's a singleton (so more like None than bools) where
instantiating the class returns the singleton
Hi Steven,
On 17/01/17 07:05, Steven D'Aprano wrote:
I wish to emulate a "final" class using Python, similar to bool:
[snip]
It doesn't have to be absolutely bulletproof, but anyone wanting to subclass my
class should need to work for it, which hopefully will tell them that they're
doing som
Op 17-01-17 om 08:05 schreef Steven D'Aprano:
> I wish to emulate a "final" class using Python, similar to bool:
>
> py> class MyBool(bool):
> ... pass
> ...
> Traceback (most recent call last):
> File "", line 1, in
> TypeError: type 'bool' is not an acceptable base type
>
>
> It doesn't h
On Tuesday 17 January 2017 18:05, Steven D'Aprano wrote:
> I wish to emulate a "final" class using Python, similar to bool:
[...]
> Any hints?
I may have a solution: here's a singleton (so more like None than bools) where
instantiating the class returns the singleton, and subclassing the class f
On 01/16/2017 11:05 PM, Steven D'Aprano wrote:
I wish to emulate a "final" class using Python, similar to bool:
py> class MyBool(bool):
... pass
...
Traceback (most recent call last):
File "", line 1, in
TypeError: type 'bool' is not an acceptable base type
It doesn't have to be absolu
I wish to emulate a "final" class using Python, similar to bool:
py> class MyBool(bool):
... pass
...
Traceback (most recent call last):
File "", line 1, in
TypeError: type 'bool' is not an acceptable base type
It doesn't have to be absolutely bulletproof, but anyone wanting to subclass
15 matches
Mail list logo