question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Decoration as instance methods?

See original GitHub issue

Right now, if I want to immediately execute a Supplier and get a result back, I can call retry.executeSupplier(supplier), which is straightforward and idiomatic. However, decorating the Supplier requires an awkward static call instead of the usual dot operator (and also can’t be used as a method handle). Would it be manageable to include default <T> Supplier<T> decorate(Supplier<T>) and friends?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
RobWincommented, Feb 1, 2019

No, but you can have a look at other tests.

1reaction
chryliscommented, Jan 30, 2019

I can do that. Do you have style and test guidelines?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I decorate an instance method with a decorator class?
2. A quick google turns up this: thecodeship.com/patterns/guide-to-python-function-decorators (see the section "Decorating methods") · 1. Have you read e.g. ...
Read more >
Working With Class and Method Decorators in Python
Decorating an Instance Method ... An instance method has an instance passed to it during invocation. We just declare that as the first...
Read more >
Decorating Methods defined in a Class With Python
A decorator is simply a function that takes a function as an argument and returns yet another function.
Read more >
Creating Decorator inside a class in Python - GeeksforGeeks
Inside Class A “fun1” Instance Method is calling the decorator function “Decorators” inside Class B “fun2”. Instance Method is calling the ...
Read more >
Decorator inside Python class - Medium
That would actually work, but there is major flaw in this approach: atomic_rating_change becomes an instance method of the User class.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found