-
Notifications
You must be signed in to change notification settings - Fork 42
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
Show a summarised snippet of the latest reply from each thread #161
Conversation
@@ -26,9 +26,11 @@ def make_engine(home: str): | |||
|
|||
class WithContent(): | |||
|
|||
data = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a class variable? Shouldn't this be an instance variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to ensure all instances have a .data
field throughout their life-time - I was getting instance has no attribute 'data'
at times otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so you should do something like
class WithContent:
def __init__(self, *nargs, **kwargs) -> None:
self.data = None
super().__init__(*nargs, **kwargs)
This makes sure every instance has a data
field. Though if a class with any fancy metaclasses subclasses this, it may break. But the solution you have will cause problems if more than one instance of this class is created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it was a mutable value I could see how this pattern could cause issues. As it’s None, from where would the problems you see stem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Python’s secretly prototypal object system - https://eev.ee/blog/2017/11/28/object-models/
Also I have been reminded that we need to |
Hey @timruffles are you still working on this? If not, we can take over and make a couple of quick changes to get this finished up. |
Please feel free to take it over! Probably won’t have time for a while |
On it :) |
1 similar comment
On it :) |
There are a few issues with this from a UX perspective at present:
Suggested minimal amendments from a UX perspective before merging:
becomes:
Finally, note that after downloading a file, its preview snippet is replaced with |
Closing in favor of #214 |
Resolves #135