top | item 43736368

(no title)

ohr | 10 months ago

Thanks, I hate it! Jk, but would you consider this a good solution overall?

discuss

order

im3w1l|10 months ago

Not him, but I would also consider making FooBarWidget have a FooWidget rather than be a FooWidget.

Normally with a FooWidget you can create one on some thread and then perform operations on it on that thread. But in the case of the FooBarWidget you can not do operations on it because operations must be done in the special thread that is inaccessible.

shiandow|10 months ago

I can't come up with a single good reason why you would wish to use inheritance in this case.

Except possibly for type checking, but

1. Python has duck typing anyway

2. It's debatable whether these two classes should be interchangeable

3. You shouldn't need to use inheritance just to make the type checking work.

It could be considered a clever hack in some situations, but it's completely unsurprising that it causes issues. Putting band-aids on it after you find a bug does not fix the real problem.

gpderetta|10 months ago

I would consider this an hack. But a reasonable hack if you can't change the base class.