<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Doug Hellmann - Latest Comments</title><link>http://doughellmann.disqus.com/</link><description></description><atom:link href="https://doughellmann.disqus.com/comments.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 26 Jan 2017 04:39:47 -0000</lastBuildDate><item><title>Re: imaplib - IMAP4 client library - Python Module of the Week</title><link>https://pymotw.com/2/imaplib/index.html#comment-3120843238</link><description>&lt;p&gt;Whole message: &lt;a href="http://imaplib_fetch_rfc822.py" rel="nofollow noopener" target="_blank" title="imaplib_fetch_rfc822.py"&gt;imaplib_fetch_rfc822.py&lt;/a&gt;&lt;br&gt;response_part[1] return to me byte string not string&lt;br&gt;i'm on python 3.5&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Petar Todorow</dc:creator><pubDate>Thu, 26 Jan 2017 04:39:47 -0000</pubDate></item><item><title>Re: namedtuple - Python Module of the Week</title><link>https://pymotw.com/2/collections/namedtuple.html#comment-3097496242</link><description>&lt;p&gt;Comments here are really not the best forum for that sort of question. You may want to try posting to the python-list mailing list.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Doug Hellmann</dc:creator><pubDate>Fri, 13 Jan 2017 10:42:33 -0000</pubDate></item><item><title>Re: namedtuple - Python Module of the Week</title><link>https://pymotw.com/2/collections/namedtuple.html#comment-3096799315</link><description>&lt;p&gt;Is this a good container type for use in parsing especially things like XML/html where you can define a structure, so use namedtuple like a struct?&lt;/p&gt;&lt;p&gt;Say if you had an XML as this&lt;/p&gt;&lt;p&gt;then defining&lt;/p&gt;&lt;p&gt;id = \\Books\@id etc&lt;br&gt;Books = collections.namedtuple('Books', 'id title publish_date author')&lt;/p&gt;&lt;p&gt;then using lxml or similar and looping&lt;/p&gt;&lt;p&gt;for book in XML:&lt;br&gt;    print(Books)&lt;/p&gt;&lt;p&gt;# bk101 XML Developer's Guide 2000-10-01 Gambardella, Matthew&lt;/p&gt;&lt;p&gt;&amp;lt;catalog&amp;gt;&lt;br&gt;   &amp;lt;book id="bk101"&amp;gt;&lt;br&gt;      &amp;lt;author&amp;gt;Gambardella, Matthew&amp;lt;/author&amp;gt;&lt;br&gt;      &amp;lt;title&amp;gt;XML Developer's Guide&amp;lt;/title&amp;gt;&lt;br&gt;      &amp;lt;genre&amp;gt;Computer&amp;lt;/genre&amp;gt;&lt;br&gt;      &amp;lt;price&amp;gt;44.95&amp;lt;/price&amp;gt;&lt;br&gt;      &amp;lt;publish_date&amp;gt;2000-10-01&amp;lt;/publish_date&amp;gt;&lt;br&gt;      &amp;lt;description&amp;gt;An in-depth look at creating applications &lt;br&gt;      with XML.&amp;lt;/description&amp;gt;&lt;br&gt;   &amp;lt;/book&amp;gt;&lt;br&gt;   &amp;lt;book id="bk102"&amp;gt;&lt;br&gt;      &amp;lt;author&amp;gt;Ralls, Kim&amp;lt;/author&amp;gt;&lt;br&gt;      &amp;lt;title&amp;gt;Midnight Rain&amp;lt;/title&amp;gt;&lt;br&gt;      &amp;lt;genre&amp;gt;Fantasy&amp;lt;/genre&amp;gt;&lt;br&gt;      &amp;lt;price&amp;gt;5.95&amp;lt;/price&amp;gt;&lt;br&gt;      &amp;lt;publish_date&amp;gt;2000-12-16&amp;lt;/publish_date&amp;gt;&lt;br&gt;      &amp;lt;description&amp;gt;A former architect battles corporate zombies, &lt;br&gt;      an evil sorceress, and her own childhood to become queen &lt;br&gt;      of the world.&amp;lt;/description&amp;gt;&lt;br&gt;   &amp;lt;/book&amp;gt;&lt;br&gt;&amp;lt;/catalog&amp;gt;&lt;/p&gt;&lt;p&gt;Is this a practicle use case and would it have drawbacks?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">sayth</dc:creator><pubDate>Thu, 12 Jan 2017 22:59:51 -0000</pubDate></item><item><title>Re: SocketServer – Creating network servers. - Python Module of the Week</title><link>https://pymotw.com/2/SocketServer/#comment-3088806374</link><description>&lt;p&gt;thanks&lt;br&gt;it was very helpfull&lt;br&gt;now I'm understanding what a handler is&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Turjak_art</dc:creator><pubDate>Sun, 08 Jan 2017 04:51:41 -0000</pubDate></item><item><title>Re: threading – Manage concurrent threads - Python Module of the Week</title><link>https://pymotw.com/2/threading/#comment-3087395582</link><description>&lt;p&gt;cristal clear explanation about the subject. Keep it up :)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Paulo Miguel Almeida</dc:creator><pubDate>Sat, 07 Jan 2017 06:20:42 -0000</pubDate></item><item><title>Re: Communication Between Processes - Python Module of the Week</title><link>https://pymotw.com/2/multiprocessing/communication.html#comment-3086268345</link><description>&lt;p&gt;I haven't worked with PyGame before, so I can't help with your question. You may have better luck asking on their mailing list or on python-list.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Doug Hellmann</dc:creator><pubDate>Fri, 06 Jan 2017 12:53:56 -0000</pubDate></item><item><title>Re: Communication Between Processes - Python Module of the Week</title><link>https://pymotw.com/2/multiprocessing/communication.html#comment-3085777232</link><description>&lt;p&gt;Hi Doug,&lt;/p&gt;&lt;p&gt;This is really well written. I've a question: How to know whether an object is shareable or not? Is it a good idea to share objects between processes? I'm working on my academic project in which I've to display video from two webcams at same time. For that I'm using pygame and multiprocessing. In which I wrote two process for two webcams but I'm unable to display the webcam feed to screen (as I'm not able to share the pygame surface object to two process). How to share pygame surface to two proocesses or any relevant information for such kind of problem?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Chakri M</dc:creator><pubDate>Fri, 06 Jan 2017 07:57:13 -0000</pubDate></item><item><title>Re: zipfile – Read and write ZIP archive files - Python Module of the Week</title><link>https://pymotw.com/2/zipfile/#comment-3080455239</link><description>&lt;p&gt;how can a i extract data from a zip file which is within a zip file.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sunil Poonia</dc:creator><pubDate>Tue, 03 Jan 2017 02:25:31 -0000</pubDate></item><item><title>Re: datetime – Date/time value manipulation - Python Module of the Week</title><link>https://pymotw.com/2/datetime/#comment-3072419655</link><description>&lt;p&gt;u can just:&lt;br&gt;&lt;a href="http://datetime.datetime.today" rel="nofollow noopener" target="_blank" title="datetime.datetime.today"&gt;datetime.datetime.today&lt;/a&gt;("%a %b %d %H:%M:%S %Y")&lt;br&gt;inside the "" you can type whatever u like. Indents, switch positions and stuff.&lt;br&gt;more you can find easily here: &lt;a href="http://stackoverflow.com/questions/311627/how-to-print-date-in-a-regular-format-in-python" rel="nofollow noopener" target="_blank" title="http://stackoverflow.com/questions/311627/how-to-print-date-in-a-regular-format-in-python"&gt;http://stackoverflow.com/qu...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Martin Stb</dc:creator><pubDate>Wed, 28 Dec 2016 10:47:22 -0000</pubDate></item><item><title>Re: asyncore – Asynchronous I/O handler - Python Module of the Week</title><link>https://pymotw.com/2/asyncore/index.html#comment-3072038555</link><description>&lt;p&gt;thanks great&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ohad Gazit</dc:creator><pubDate>Wed, 28 Dec 2016 03:27:35 -0000</pubDate></item><item><title>Re: The Performance Impact of Using dict() Instead of {} in CPython 2.7</title><link>https://doughellmann.com/blog/2012/11/12/the-performance-impact-of-using-dict-instead-of-in-cpython-2-7-2/#comment-3068519843</link><description>&lt;p&gt;I think using dict() is more pythonic than using { } because we are initiating the default class instance. I prefer this even if it may be 3 to 6 times slower as shown by your post. I use symbols for comprehensions only and not for creating dictionaries.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">shantanuo</dc:creator><pubDate>Sun, 25 Dec 2016 08:15:20 -0000</pubDate></item><item><title>Re: Communication Between Processes - Python Module of the Week</title><link>https://pymotw.com/2/multiprocessing/communication.html#comment-3064306353</link><description>&lt;p&gt;Good question. It doesn't matter how you save the reference to the lock. It doesn't know what object or code path is being protected. It's up to the users of the lock to coordinate and all use the same lock instance. One convenient way to do that is to attach the lock to the object being locked so it is easy to access, but that's not a requirement.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Doug Hellmann</dc:creator><pubDate>Thu, 22 Dec 2016 09:17:00 -0000</pubDate></item><item><title>Re: Communication Between Processes - Python Module of the Week</title><link>https://pymotw.com/2/multiprocessing/communication.html#comment-3064276150</link><description>&lt;p&gt;Really well written, more people should write tutorials like you do! One thing that I don't understand though, the lock-example, does the lock there really do anything? My understanding was that the lock had to be a property of the object that you want to be locked.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Theragingwalrus</dc:creator><pubDate>Thu, 22 Dec 2016 08:54:20 -0000</pubDate></item><item><title>Re: weakref – Garbage-collectable references to objects¶</title><link>https://pymotw.com/2/weakref/#comment-3058815243</link><description>&lt;p&gt;Really nice introduction to weakref module and the concept. Thank you!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Satish Goda</dc:creator><pubDate>Mon, 19 Dec 2016 01:46:37 -0000</pubDate></item><item><title>Re: functools – Tools for Manipulating Functions¶</title><link>https://pymotw.com/2/functools/#comment-3051786813</link><description>&lt;p&gt;Thank you!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">junghanChoi</dc:creator><pubDate>Wed, 14 Dec 2016 09:42:22 -0000</pubDate></item><item><title>Re: webbrowser – Displays web pages - Python Module of the Week</title><link>https://pymotw.com/2/webbrowser/#comment-3050399976</link><description>&lt;p&gt;Is it possible to embbed webbrowser result from webbrowser.open_url(whatever) in a wxpython panel similar to wx.lib.iewin ?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alejandro Rodríguez Cuevas</dc:creator><pubDate>Tue, 13 Dec 2016 13:13:51 -0000</pubDate></item><item><title>Re: decimal – Fixed and floating point math - Python Module of the Week</title><link>https://pymotw.com/2/decimal/#comment-3046922869</link><description>&lt;p&gt;Decimals support the same formatting instructions as ints, floats, and other numerical types. &lt;a href="https://docs.python.org/3.5/library/string.html#formatspec" rel="nofollow noopener" target="_blank" title="https://docs.python.org/3.5/library/string.html#formatspec"&gt;https://docs.python.org/3.5...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Doug Hellmann</dc:creator><pubDate>Sun, 11 Dec 2016 11:01:05 -0000</pubDate></item><item><title>Re: TCP/IP Client and Server - Python Module of the Week</title><link>https://pymotw.com/2/socket/tcp.html#comment-3040882506</link><description>&lt;p&gt;That I did not know.  Will do.  Hopefully I'll pull out from my tailspin.  Much appreciated.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Cliff in Auld Reekie</dc:creator><pubDate>Wed, 07 Dec 2016 13:40:00 -0000</pubDate></item><item><title>Re: TCP/IP Client and Server - Python Module of the Week</title><link>https://pymotw.com/2/socket/tcp.html#comment-3040820476</link><description>&lt;p&gt;You'll probably have more luck with that level of question if you ask on python-list (&lt;a href="https://www.python.org/community/lists/)" rel="nofollow noopener" target="_blank" title="https://www.python.org/community/lists/)"&gt;https://www.python.org/comm...&lt;/a&gt; where more folks are actively discussing design questions like this.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Doug Hellmann</dc:creator><pubDate>Wed, 07 Dec 2016 13:06:48 -0000</pubDate></item><item><title>Re: TCP/IP Client and Server - Python Module of the Week</title><link>https://pymotw.com/2/socket/tcp.html#comment-3040353689</link><description>&lt;p&gt;Very nice tutorial but, as usual I find myself with another very useful fragment and little to steer me on how to plug it into a more useful application.&lt;br&gt;So, as an experiment, I have a temperature monitor attached to a RPi.   It reads the temp probe in a main loop and can write it to mySQL, flip arrays for heater or fan to maintain a temperature, or display temp on LCD.&lt;br&gt;Next step was to connect iOS device to read and manage the temperature.&lt;br&gt;My troubles start when I add this sockets service because: it sets things up then stalls the main loop whilst waiting for a client.  Would you suggest this is in a separate thread or another approach?&lt;br&gt;The iOS app connects and receives data but the RPI side then sits in a wait state after sending data (eg. current temperature) in JSON stream.  A c.close() chops the session but I can't seem to restart on same port.&lt;br&gt;I want it to start managing the temperature, start a socks-connection, wait for a client (but keep maintaining temperature), handle client connect and start streaming and responding to requests from client, handle disconnect and be ready for a new connection.   Maybe a little advanced for this thread and for that I apologise.   However, any thoughts would be most appreciated.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Cliff in Auld Reekie</dc:creator><pubDate>Wed, 07 Dec 2016 08:20:33 -0000</pubDate></item><item><title>Re: webbrowser – Displays web pages - Python Module of the Week</title><link>https://pymotw.com/2/webbrowser/#comment-3040164819</link><description>&lt;p&gt;I'm having problems with webbrowser on my Mac, when I run the open command on a url it just returns 'True' but nothing else happens, Ive listed the available browsers and theres's 'macosx', 'firefox', and 'safari' but I get the same problem with all, this is in Python 2.7 and 3.5 (I have both installed) and my firewall is switched off.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">David Jones</dc:creator><pubDate>Wed, 07 Dec 2016 04:52:54 -0000</pubDate></item><item><title>Re: decimal – Fixed and floating point math - Python Module of the Week</title><link>https://pymotw.com/2/decimal/#comment-3040092604</link><description>&lt;p&gt;Could not find this anywhere is it:&lt;br&gt;print "%s" % decimal.Decimal(value)&lt;br&gt;or &lt;br&gt;print "%.f2" %  decimal.Decimal(value)&lt;br&gt;?&lt;br&gt;there is nothing documented in relation between print mini-language and Decimal (class) numbers.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">LJGww</dc:creator><pubDate>Wed, 07 Dec 2016 03:31:22 -0000</pubDate></item><item><title>Re: dbhash – DBM-style API for the BSD database library¶</title><link>https://pymotw.com/2/dbhash/index.html#comment-3032002956</link><description>&lt;p&gt;Thanks for reporting this problem. I have been working on the Python 3 updates (see &lt;a href="https://pymotw.com/3/)" rel="nofollow noopener" target="_blank" title="https://pymotw.com/3/)"&gt;https://pymotw.com/3/)&lt;/a&gt; so I've let this part of the site get a little stale. The links should now be pointing to the right places.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Doug Hellmann</dc:creator><pubDate>Fri, 02 Dec 2016 17:30:53 -0000</pubDate></item><item><title>Re: webbrowser – Displays web pages - Python Module of the Week</title><link>https://pymotw.com/2/webbrowser/#comment-3031987000</link><description>&lt;p&gt;Great example!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Doug Hellmann</dc:creator><pubDate>Fri, 02 Dec 2016 17:19:31 -0000</pubDate></item><item><title>Re: webbrowser – Displays web pages - Python Module of the Week</title><link>https://pymotw.com/2/webbrowser/#comment-3031760589</link><description>&lt;p&gt;This is helpful - I love that you can jump to a browser from an interactive session, or even write it into a script, I wonder whatelse can be done like this? I used the example to open a google search page, then thought it'd be cool if I could enter the search paramaters too&lt;/p&gt;&lt;p&gt;So I looked at what happens to the address when you search something, and found out this&lt;/p&gt;&lt;p&gt;If I want to open a google search page AND search for something (so show the search results) I would do the following:&lt;/p&gt;&lt;p&gt;To search Google for the word Python&lt;/p&gt;&lt;p&gt;import webbrowser&lt;br&gt;&lt;a href="http://webbrowser.open" rel="nofollow noopener" target="_blank" title="webbrowser.open"&gt;webbrowser.open&lt;/a&gt;('&lt;a href="http://google.co.uk/#q=python')" rel="nofollow noopener" target="_blank" title="http://google.co.uk/#q=python')"&gt;http://google.co.uk/#q=pyth...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;after (.com) or (.co.uk) you add /#q=SEARCH+WORD&lt;/p&gt;&lt;p&gt;then you can search for anything from a Python Shell or terminal. This is Awesome Thanks&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ben</dc:creator><pubDate>Fri, 02 Dec 2016 15:34:52 -0000</pubDate></item></channel></rss>