-
-
Notifications
You must be signed in to change notification settings - Fork 512
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
Cached properties without triggering the cache? #1518
Comments
Thanks for the report. This is unfortunately not really a bug but a "feature". I was against adding this, but most users wanted this kind of side effect. There's still a hidden way to toggle this, which might be good enough for you. You can say
That should probably do the work. (No idea how you get that properly into an IPython session). In fact I put in a ton of effort to avoid these kind of cases and a lot of people in the community complained that their properties weren't working anymore. See also this issue: #1299 (comment) PS: While I think you raise a valid point, I think it's an anti pattern to do a lot of calculations in properties. In general I think functions are better, because they allow you to "change" the functionality in the future while not breaking backwards compatibility. This has proven to be a big issue for Jedi in the past. So just a few thoughts (I know that's not always feasible to touch large code bases). |
Can we perhaps get this to be an official and non private setting? |
Feel free to create a pull request with |
In a library I work on, we have several "heavy" properties which look something like this (dummy example):
etc. (dozens of properties).
The problem is that creating an instance and hitting
TAB
will evaluate all the code inside theif
-blocks sinceJedi
sees that the values areNone
, which means the REPL is hanging for several seconds (up to minutes).Is there a way to e.g. tell Jedi beforehand about the signature of these properties to prevent this huge lag? I also tried using different implementations of
@cached_property
decorators but they have the same problems.I also tried with type hints without success:
The text was updated successfully, but these errors were encountered: