-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Experiment with PoolableStatuses #25
Experiment with PoolableStatuses #25
Conversation
It's unclear to see from the diff what changed precisely, because of the formatting, could you roll that part back? RE the dynamic class creation just to happify instance checks, it seems like a partial solution, because, suppose we merge this PR: active_status = ActiveStatus('foo')
self.pool.a = active_status
assert self.pool.a == active_status # passes
assert isinstance(self.pool.a, ActiveStatus) # passes
assert self.pool.a is active_status # fails! So what are we trying to achieve? I think we'd better take one of two radical approaches:
|
I rolled back the formatting, sorry about that, it is run automatically from my editor. About I completely agree that it is not a perfect solution because the object that is ultimately assigned is not the same as the object that was provided. I did this experiment mostly to get a better understanding of what was possible and I do not think we should merge it ever. Regarding the approaches you are suggesting, I do not think I agree with Regarding I would suggest an option 3. If we were to make the The only feature that would be difficult to keep as-is in the case is |
Yeah, the long-term plan is to move some of this functionality to The only new object would then be a StatusPool and the user code would look like:
We're getting pretty close to @swalladge 's proposal I believe. Unless, of course, since everything is now dynamic, we drop unset as we can simply delete stuff and add it back later. 🤔 |
Small experiment to work try and fix #24.
When assigning
StatusBase
objects to aStatusPool
, we dynamically transform those object in a poolable version, by creating a new type that inherits from bothStatus
and the concreteStatusBase
type of the passed object.In other words:
There are also some changes to
Status
to complete the goal:This is only a work in progress to get some discussions started, the unit tests were still passing locally, but this probably breaks stuff.