Using __new__
dn
PythonList at DancesWithMice.info
Sat Feb 17 19:05:54 EST 2024
On 18/02/24 12:48, Jonathan Gossage wrote:
> The problem that I am facing is that when the superclass is not
> 'object', the __init__ method may well need arguments. I do not know how
> to determine if the superclass is 'object'. For what it is worth, any
> attempt to use this with different arguments should return the initial
> singleton and ignore further attempts to create a second instance.
1 "object"
don't understand. Perhaps give us a broader description of the problem?
Remember also ABCs (Abstract Base Classes).
2 arguments
yes, must accommodate arguments in __new__() if some/same are needed in
__init__() However, when using the default "object", the super() does
not need, use, or want, any arguments to be passed.
3 singleton
don't think that is happening!
PS please reply to the list - there may be others who can learn from, or
contribute to, this conversation!
--
Regards,
=dn
More information about the Python-list
mailing list