<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>saghul, on code - Latest Comments</title><link>http://saghul-codeblog.disqus.com/</link><description></description><atom:link href="https://saghul-codeblog.disqus.com/comments.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 21 Jun 2018 05:35:50 -0000</lastBuildDate><item><title>Re: PyStructSequence: creating named tuples in C</title><link>http://code.saghul.net/index.php/2012/04/23/pystructsequence-creating-named-tuples-in-c/#comment-3954117801</link><description>&lt;p&gt;Hello, thanks for your article !&lt;br&gt;I hope it's not outdated yet.&lt;/p&gt;&lt;p&gt;I wanted to know how I can convert a struct to a namedtuple in order to pass it in python, and this seems like it could do the job.&lt;/p&gt;&lt;p&gt;However, I did not understand the concept of PyStructSequence_InitType . Why do we need a type for creating a namedtuple ? Shouldn't it be just a PyObject ?&lt;/p&gt;&lt;p&gt;Also what is the line "FooResultType = {0, 0, 0, 0, 0, 0};" doing ? Is it creating a dummy type ? Some documentation tend to say that a PyTypeObject is much longer to specify : &lt;a href="https://docs.python.org/3.5/extending/newtypes.html" rel="nofollow noopener" target="_blank" title="https://docs.python.org/3.5/extending/newtypes.html"&gt;https://docs.python.org/3.5...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Thanks in advance for your explanations ! :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Clément Pinard</dc:creator><pubDate>Thu, 21 Jun 2018 05:35:50 -0000</pubDate></item><item><title>Re: About me</title><link>http://code.saghul.net/index.php/about-me/#comment-3710067979</link><description>&lt;p&gt;well, i guess i will be upfront...i'm looking for a developer to ugrade my service. if you are interested or know someone who is, please contact me at the above address, thank you.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">David Cook</dc:creator><pubDate>Mon, 15 Jan 2018 23:48:17 -0000</pubDate></item><item><title>Re: About me</title><link>http://code.saghul.net/index.php/about-me/#comment-3690683191</link><description>&lt;p&gt;hello, can you contact me at dave@copycall.com&lt;br&gt;thank you.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">David Cook</dc:creator><pubDate>Wed, 03 Jan 2018 20:22:29 -0000</pubDate></item><item><title>Re: lambda vs. functools.partial</title><link>http://code.saghul.net/index.php/2010/11/20/lambda-vs-functools-partial/#comment-3660662156</link><description>&lt;p&gt;Amazing article!&lt;br&gt;Using "partial" fixed my problem. Before I was trying to implement "lambda" but the problem was with "late binding". My lambda expression (anonymous function) was executed each time I was pressing button (using PyQt 4) and that expression remembered only last value. I was searching another way to "tattoo" name of function to call and value of parameter into my button object - not to load it each time I press the button. "Partial" allowed me to tattoo this costruction into my button. Thanks! :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Adam Brzęcki</dc:creator><pubDate>Wed, 13 Dec 2017 11:58:14 -0000</pubDate></item><item><title>Re: Implementing registry pattern with class decorators</title><link>http://code.saghul.net/index.php/2011/01/09/implementing-registry-pattern-with-class-decorators/#comment-3519382945</link><description>&lt;p&gt;It depends on the python-application package, which I forgot to mention!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">saghul</dc:creator><pubDate>Fri, 15 Sep 2017 16:50:53 -0000</pubDate></item><item><title>Re: Implementing registry pattern with class decorators</title><link>http://code.saghul.net/index.php/2011/01/09/implementing-registry-pattern-with-class-decorators/#comment-3519174838</link><description>&lt;p&gt;where does application.python.util.Singleton come from?  It doesn't work to have sample code if it's not all present.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Brett Swift</dc:creator><pubDate>Fri, 15 Sep 2017 14:33:49 -0000</pubDate></item><item><title>Re: Winds of change</title><link>http://code.saghul.net/index.php/2016/12/21/winds-of-change/#comment-3062470908</link><description>&lt;p&gt;Congrats man! You deserve it, so have fun and hardwork in your new beggining ;).&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Oier</dc:creator><pubDate>Wed, 21 Dec 2016 07:45:10 -0000</pubDate></item><item><title>Re: Winds of change</title><link>http://code.saghul.net/index.php/2016/12/21/winds-of-change/#comment-3062373691</link><description>&lt;p&gt;We all know this new chapter in your career is gonna be awesome and you gonna kick some ass ;)&lt;/p&gt;&lt;p&gt;Congrats! change always has positive things ;)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">mikjimenez</dc:creator><pubDate>Wed, 21 Dec 2016 05:49:36 -0000</pubDate></item><item><title>Re: LXD, Debian containers and systemd</title><link>http://code.saghul.net/index.php/2016/01/15/lxd-debian-containers-and-systemd/#comment-2965045030</link><description>&lt;p&gt;I spent several hours running up against this before filing a bug and having them close it within minutes is so infuriating.  If debian jessie is broken under lxc they should not be publishing images based on it.  I'll try this recipe to see if this solves my problems as well.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">brontide</dc:creator><pubDate>Sun, 23 Oct 2016 12:10:46 -0000</pubDate></item><item><title>Re: LXD, Debian containers and systemd</title><link>http://code.saghul.net/index.php/2016/01/15/lxd-debian-containers-and-systemd/#comment-2794240416</link><description>&lt;p&gt;I have been trying to be somewhat creative in doing Debian 8 under Ubuntu 16.04. The creative trick is trying to install Xivo (PBX in a Flash). I created the container, but I can't seem to have an environment that I would have had is I were doing netinstall....&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Kim Callis</dc:creator><pubDate>Wed, 20 Jul 2016 18:45:18 -0000</pubDate></item><item><title>Re: Trying out concurrent.futures</title><link>http://code.saghul.net/index.php/2012/09/07/trying-out-concurrent-futures/#comment-1534980706</link><description>&lt;p&gt;The reason for the performance difference is that multiprocessing.Pool will batch the iterable passed to map into chunks, and then pass the chunks to the worker processes, which reduces the overhead of IPC between the parent and children. ProcessPoolExecutor always passes one item from the iterable at a time to the children, which can lead to much slower performance with large iterables, due to the increased IPC overhead. However, looking at this message: &lt;a href="http://bugs.python.org/issue9205#msg132661" rel="nofollow noopener" target="_blank" title="http://bugs.python.org/issue9205#msg132661"&gt;http://bugs.python.org/issu...&lt;/a&gt; It looks like using concurrent.futures is not bad choice if utterable is small and if you use the latest API hopefully in Py3.x if the API are improved if the put multiprocess into concurrent/*  and you are on the right track.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">San Luthra</dc:creator><pubDate>Sat, 09 Aug 2014 11:04:58 -0000</pubDate></item><item><title>Re: Using functools.partial instead of saving arguments</title><link>http://code.saghul.net/index.php/2012/11/09/using-functools-partial-instead-of-saving-arguments/#comment-1139661113</link><description>&lt;p&gt;Interesting :-) Still, saving a stack frame is nice for traceback printing ;-)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">saghul</dc:creator><pubDate>Tue, 26 Nov 2013 10:39:06 -0000</pubDate></item><item><title>Re: Using functools.partial instead of saving arguments</title><link>http://code.saghul.net/index.php/2012/11/09/using-functools-partial-instead-of-saving-arguments/#comment-1139632938</link><description>&lt;p&gt;Pypy 2.1 (please note that the order of the tests is changed)&lt;/p&gt;&lt;p&gt;In [2]: %timeit testpartial.do_test(testpartial.WorkItemPartial)&lt;/p&gt;&lt;p&gt;1000000 loops, best of 3: 535 ns per loop&lt;/p&gt;&lt;p&gt;In [3]: %timeit testpartial.do_test(testpartial.WorkItem)&lt;/p&gt;&lt;p&gt;10000000 loops, best of 3: 58.5 ns per loop&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">schlamar</dc:creator><pubDate>Tue, 26 Nov 2013 10:19:45 -0000</pubDate></item><item><title>Re: Serving a WSGI app, WebSockets and static files with Twisted</title><link>http://code.saghul.net/index.php/2013/07/09/serving-a-wsgi-app-websockets-and-static-files-with-twisted/#comment-1078858639</link><description>&lt;p&gt;great, thanks&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">zanio</dc:creator><pubDate>Fri, 11 Oct 2013 11:01:24 -0000</pubDate></item><item><title>Re: On the libuv core team!</title><link>http://code.saghul.net/index.php/2013/09/06/on-the-libuv-core-team/#comment-1032992348</link><description>&lt;p&gt;Congratsss!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">mikjimenez</dc:creator><pubDate>Fri, 06 Sep 2013 21:49:22 -0000</pubDate></item><item><title>Re: Using functools.partial instead of saving arguments</title><link>http://code.saghul.net/index.php/2012/11/09/using-functools-partial-instead-of-saving-arguments/#comment-1032848856</link><description>&lt;p&gt;And apparently it saves you a stack frame!&lt;/p&gt;&lt;p&gt;&lt;a href="http://tech.pro/tutorial/1520/partial-function-application-in-python" rel="nofollow noopener" target="_blank" title="http://tech.pro/tutorial/1520/partial-function-application-in-python"&gt;http://tech.pro/tutorial/15...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Juanlu001</dc:creator><pubDate>Fri, 06 Sep 2013 18:54:39 -0000</pubDate></item><item><title>Re: Trying out concurrent.futures</title><link>http://code.saghul.net/index.php/2012/09/07/trying-out-concurrent-futures/#comment-1032836714</link><description>&lt;p&gt;To be honest I never used multiprocessing.Pool myself :-S Not sure how much overhead Futures add, here, but you might have found a nasty bug, they should perform equally, I guess.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">saghul</dc:creator><pubDate>Fri, 06 Sep 2013 18:46:57 -0000</pubDate></item><item><title>Re: Trying out concurrent.futures</title><link>http://code.saghul.net/index.php/2012/09/07/trying-out-concurrent-futures/#comment-1032834915</link><description>&lt;p&gt;I made a change so now they look almost identical, and the performance of &lt;a href="http://pool_futures.py" rel="nofollow noopener" target="_blank" title="pool_futures.py"&gt;pool_futures.py&lt;/a&gt; is still very poor:&lt;/p&gt;&lt;p&gt;&lt;a href="https://gist.github.com/Juanlu001/6470913" rel="nofollow noopener" target="_blank" title="https://gist.github.com/Juanlu001/6470913"&gt;https://gist.github.com/Jua...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Juanlu001</dc:creator><pubDate>Fri, 06 Sep 2013 18:45:47 -0000</pubDate></item><item><title>Re: Trying out concurrent.futures</title><link>http://code.saghul.net/index.php/2012/09/07/trying-out-concurrent-futures/#comment-1032827280</link><description>&lt;p&gt;I don't fully understand the advantages of using `ProcessPoolExecutor` versus the old `Pool` in multiprocessing. Consider these two pieces of code, adapted from yours:&lt;/p&gt;&lt;p&gt;&lt;a href="https://gist.github.com/Juanlu001/6470913" rel="nofollow noopener" target="_blank" title="https://gist.github.com/Juanlu001/6470913"&gt;https://gist.github.com/Jua...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;In my computer:&lt;/p&gt;&lt;p&gt;[juanlu@nebulae]─[~/Development/Python/test]&lt;br&gt;└[00:35:30] $ time python &lt;a href="http://pool_multiprocessing.py" rel="nofollow noopener" target="_blank" title="pool_multiprocessing.py"&gt;pool_multiprocessing.py&lt;/a&gt;&lt;/p&gt;&lt;p&gt;real    0m0.190s&lt;br&gt;user    0m0.217s&lt;br&gt;sys    0m0.020s&lt;br&gt;[juanlu@nebulae]─[~/Development/Python/test]&lt;br&gt;└[00:35:31] $ time python &lt;a href="http://pool_futures.py" rel="nofollow noopener" target="_blank" title="pool_futures.py"&gt;pool_futures.py&lt;/a&gt;&lt;/p&gt;&lt;p&gt;real    0m2.426s&lt;br&gt;user    0m3.400s&lt;br&gt;sys    0m0.577s&lt;/p&gt;&lt;p&gt;I didn't understand the advantages, and now I understand the performance even less. Trying to run cProfile on them gives strange errors, so I couldn't figure out the issue. What do you think?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Juanlu001</dc:creator><pubDate>Fri, 06 Sep 2013 18:38:14 -0000</pubDate></item><item><title>Re: On the libuv core team!</title><link>http://code.saghul.net/index.php/2013/09/06/on-the-libuv-core-team/#comment-1032707931</link><description>&lt;p&gt;Congratz!!!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Juan Riaza</dc:creator><pubDate>Fri, 06 Sep 2013 17:38:10 -0000</pubDate></item><item><title>Re: uvent: a gevent core implemented using libuv</title><link>http://code.saghul.net/index.php/2012/10/04/uvent-a-gevent-core-implemented-using-libuv/#comment-818493611</link><description>&lt;p&gt;damn you are so productive.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">blog.est.im</dc:creator><pubDate>Sun, 03 Mar 2013 20:18:26 -0000</pubDate></item><item><title>Re: Fast(er) locks in Python?</title><link>http://code.saghul.net/index.php/2012/11/02/faster-locks-in-python/#comment-707666713</link><description>&lt;p&gt;Thanks for pointing it out Antoine! I added an update to the post.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">saghul</dc:creator><pubDate>Sun, 11 Nov 2012 12:09:43 -0000</pubDate></item><item><title>Re: Fast(er) locks in Python?</title><link>http://code.saghul.net/index.php/2012/11/02/faster-locks-in-python/#comment-707560626</link><description>&lt;p&gt;For the record, threading.RLock is now implemented in C (since Python 3.2, I believe), and the timeout option also is.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Antoine</dc:creator><pubDate>Sun, 11 Nov 2012 08:17:58 -0000</pubDate></item><item><title>Re: Using functools.partial instead of saving arguments</title><link>http://code.saghul.net/index.php/2012/11/09/using-functools-partial-instead-of-saving-arguments/#comment-706904606</link><description>&lt;p&gt;It is a bit less readable for the not so fond of functional programming right? I guess it is a trader off between code complexity and performance. &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">João Mesquita</dc:creator><pubDate>Sat, 10 Nov 2012 07:49:25 -0000</pubDate></item><item><title>Re: uvent: a gevent core implemented using libuv</title><link>http://code.saghul.net/index.php/2012/10/04/uvent-a-gevent-core-implemented-using-libuv/#comment-677069218</link><description>&lt;p&gt;Two questions, please:1) Is it possible to implement libev on top of libuv with uvent as abstraction layer between them?2) Does it work in Firefox? I need it for a project (an already sold project).THANKS!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Gonçalo</dc:creator><pubDate>Thu, 04 Oct 2012 22:33:05 -0000</pubDate></item></channel></rss>