Warning: Undefined array key 1 in /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php on line 505
Warning: Undefined array key 2 in /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php on line 505
Warning: Cannot modify header information - headers already sent by (output started at /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php:505) in /home/yogindar/www/blog/wp-content/plugins/visitors-online/visitors-online.php on line 557 Introduction to Python Decorators | Linux Magazine – Technical Articles
I faced a situation recently while building a Web application where a Web service that we made requests from would occasionally hang when we made a request. Because we run our application on Linux, we decided to use signals to add a timeout to our request. Because we use Python, we implemented the timeout as a decorator, since we knew we would likely find other places where we needed to add timeouts. A simplified version of this code makes an excellent introduction to how decorators work.
24 years of experience in various layers of software. Primarily experienced in system side software design and development on server management software. Interested in linux development in x86 and arm architecture.