Skip to main content
0 votes
3 answers
109 views

I want to construct objects which support arithmetic operations and have extra methods, e.g: class Timestamp(int): def as_seconds(self): return self / 90000 The extra method works: >&...
tuserun's user avatar
  • 11
0 votes
1 answer
68 views

I'm trying to subclass an edit box in a dialog in VS C++ 2022. I want to intercept any key presses in a particular edit box to do further processing. Here's my code. The 4th line confuses me because I ...
WillDotson's user avatar
1 vote
2 answers
128 views

I'm new to JS and implementing a polymorphic class hierachy. It appears that within the super constructor (when called from a derived constructor), 'this' refers to the derived class, not the super ...
TreeTownGreen's user avatar
0 votes
1 answer
111 views

I want to color a TButton control in C++Builder. I am trying to follow the information I found that suggests using SetWindowLong() to enable the BS_OWNERDRAW style for my TButton control, then catch ...
Kevin's user avatar
  • 52
0 votes
0 answers
121 views

I've been trying to solve this little problem the whole day, and I can't figure out what's wrong. I suppose this is a simple problem for some. So I'm trying to Subclass Notepad with a procedure that ...
Whicked Hayo's user avatar
1 vote
1 answer
74 views

I have a sequence of 16 elements (dealer and vulnerability of bridge boards, to be specific) that repeat endlessly in theory (in practice it almost never gets past 128, and rarely past 36). That is, ...
Mycroft's user avatar
  • 113
0 votes
0 answers
64 views

Suppose that you want to create a new subclass for float, using the following code: class MyFloat(float): def __new__(cls,number,extra): return super().__new__(cls,number) def ...
Glen O's user avatar
  • 733
1 vote
1 answer
220 views

I'm attempting to create a subclass of pathlib.Path that will do some manipulation to the passed string path value before passing it along to the base class. class MyPath(Path): def __init__(self, ...
Kyle's user avatar
  • 4,406
1 vote
1 answer
279 views

(tensorflow 2.17, Windows 10) I can't save and restore a custom model using subclassing method. Please find below the code to reproduce the problem : import numpy as np import tensorflow as tf x = np....
u2gilles's user avatar
  • 7,433
1 vote
1 answer
128 views

I'm trying to write an inheritence logic where I clone an input class and inherit from remaining parent classes. In order to do that, I need to create a new class, deep copying one of the classes ...
ozgeneral's user avatar
  • 6,909
0 votes
0 answers
93 views

I'll call an "atomic" attribute of a python class to be one from which all other user defined attributes derive. For example, the attribute a in the class below is atomic to A because all ...
gdavtor's user avatar
  • 570
1 vote
0 answers
182 views

I have an existing enumeration with a number of values defined in package b, and I want to add behavior in the current package a. I understand that you can't directly subclass an enum with existing ...
Paul's user avatar
  • 311
1 vote
0 answers
93 views

I have developed a class that subclasses from CMFCButton. I load three PNG images (with transparent zones) to the button foreground in the DrawButton function for three states: Normal Hovered Pushed ...
al072's user avatar
  • 99
1 vote
0 answers
40 views

I'm trying to implement my subclass of pd.Series, but original pd.Series methods don't work as expected and return Nan class Subclass(pd.Series): # see https://pandas.pydata.org/pandas-docs/stable/...
Mary.A's user avatar
  • 23
1 vote
2 answers
91 views

Is there a way to subclass set, with the binary operator returning the subclassed type, without redefining them ? example : class A(set): pass a = A([1,2,3]) & A([1,2,4]) a.__class__ == A # ...
hl037_'s user avatar
  • 3,957

15 30 50 per page
1
2 3 4 5
57