Conversation
Notices
-
menherahair (menherahair@eientei.org)'s status on Wednesday, 20-Dec-2023 21:34:56 JST menherahair confusing, just slightly - Machismo repeated this.
-
menherahair (menherahair@eientei.org)'s status on Wednesday, 20-Dec-2023 21:34:55 JST menherahair If you want to do the old trick of tracking instances in a class attribute, you still have to do it from __init__:
> class Niggas():
> standing_by = []
> def __init__(self):
> self.__class__.standing_by += [self]
I guess I should forget about __new__ now. -
Machismo (zerglingman@freespeechextremist.com)'s status on Wednesday, 20-Dec-2023 21:36:11 JST Machismo @menherahair __new__ is probably what's called when you do Class(whatever). -
Machismo (zerglingman@freespeechextremist.com)'s status on Wednesday, 20-Dec-2023 21:37:23 JST Machismo @menherahair
>>> class A():
... def __new__(cls,*args,**kwargs):
... print('NIGGERS')
... super().__new__(*args,**kwargs)
...
>>> A()
NIGGERS
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 4, in __new__
TypeError: object.__new__(): not enough arguments -
Machismo (zerglingman@freespeechextremist.com)'s status on Wednesday, 20-Dec-2023 21:40:11 JST Machismo @menherahair fun code* -
menherahair (menherahair@eientei.org)'s status on Wednesday, 20-Dec-2023 21:40:12 JST menherahair @Zerglingman It's explained just below, I'm merely pondering what bad code it could be used for. Machismo likes this. -
menherahair (menherahair@eientei.org)'s status on Wednesday, 20-Dec-2023 21:43:12 JST menherahair @Zerglingman Valid, but ugly (sic) Machismo likes this.