Quantcast
Channel: Python decorator runs during import before function is called - Stack Overflow
Browsing latest articles
Browse All 2 View Live

Answer by klewis for Python decorator runs during import before function is...

@Nickolay 's comment got me to the desired behavior:If I want something to execute only when the decorated function is invoked the code needs to be placed within the wrapper.So the solution is:def...

View Article



Python decorator runs during import before function is called

I'm trying to use a decorator check_wake_server to check if a remote host is available before before executing a host_function that interacts with that host. The issue I'm hitting is that the decorator...

View Article
Browsing latest articles
Browse All 2 View Live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>