<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-18508356.post4718691580616017838..comments</id><updated>2010-07-01T08:20:24.966-04:00</updated><category term='linux'/><category term='hygiene'/><category term='cascade'/><category term='python programming'/><category term='javascript'/><category term='flot'/><category term='wxwindows'/><category term='REST'/><category term='dynamic'/><category term='ajax'/><category term='programming'/><category term='macros'/><category term='sqlalchemy'/><category term='pymongo'/><category term='sourceforge'/><category term='decorator'/><category term='10gen'/><category term='wxpython'/><category term='lisp'/><category term='websockets'/><category term='mongodb'/><category term='pycon'/><category term='mapreduce'/><category term='metapython'/><category term='posgresql'/><category term='descriptor'/><category term='grok'/><category term='zeromq'/><category term='gevent'/><category term='python'/><category term='cherrypy'/><category term='zope'/><category term='turbogears'/><category term='aggregation'/><category term='ming'/><category term='zarkov'/><category term='datalog'/><category term='json'/><category term='socket.io'/><category term='compiler'/><title type='text'>Comments on Just a little Python: Python Macros?</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.pythonisito.com/feeds/4718691580616017838/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html'/><author><name>Rick Copeland</name><uri>http://www.blogger.com/profile/11612114223288841087</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_nBbh7fCcv1w/SLBwYXLKA2I/AAAAAAAAABM/EgRC77lqhr0/S220/headshot_enhanced.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-18508356.post-3860967716434770723</id><published>2010-07-01T08:20:24.920-04:00</published><updated>2010-07-01T08:20:24.920-04:00</updated><title type='text'>I want to replace for with a parallel_for that doe...</title><content type='html'>I want to replace for with a parallel_for that does something else with the block underneath the for.  In order to do that with &amp;quot;with&amp;quot; I need to bracket the &amp;quot;for&amp;quot; with &amp;quot;withs&amp;quot;&lt;br /&gt;&lt;br /&gt;with parallel_sync():&lt;br /&gt;    for i in range(0,4):&lt;br /&gt;       with parallel_split():&lt;br /&gt;           ...closure that will have each&lt;br /&gt;           instance of the &amp;quot;for&amp;quot; run in&lt;br /&gt;           ...parallel&lt;br /&gt;&lt;br /&gt;This is the only way I can know, &lt;br /&gt;1)each time I enter and leave an individual loop of the for block&lt;br /&gt;2)when I leave the entire for block</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/3860967716434770723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/3860967716434770723'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1277986824920#c3860967716434770723' title=''/><author><name>D Minor</name><uri>http://www.blogger.com/profile/12466427440382934673</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1989764491'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-2864381492818663821</id><published>2010-04-17T17:15:53.444-04:00</published><updated>2010-04-17T17:15:53.444-04:00</updated><title type='text'>decent for macro&amp;#39;ed with a while</title><content type='html'>decent for macro&amp;#39;ed with a while</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/2864381492818663821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/2864381492818663821'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1271538953444#c2864381492818663821' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1600518915'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-8105623154326843364</id><published>2010-03-13T17:36:17.998-05:00</published><updated>2010-03-13T17:36:17.998-05:00</updated><title type='text'>http://www.cs.brown.edu/~sk/Publications/Talks/Swi...</title><content type='html'>http://www.cs.brown.edu/~sk/Publications/Talks/SwineBeforePerl/&lt;br /&gt;&lt;br /&gt;Watch the presentation and the slides about implementing a Finite Automata using Scheme Macros.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/8105623154326843364'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/8105623154326843364'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1268519777998#c8105623154326843364' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-670897975'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-5442858167903985181</id><published>2009-11-18T09:50:50.911-05:00</published><updated>2009-11-18T09:50:50.911-05:00</updated><title type='text'>@jeremy:

The way this is typically done in python...</title><content type='html'>@jeremy:&lt;br /&gt;&lt;br /&gt;The way this is typically done in python is to write an assertion function (this is how the unittest module does it):&lt;br /&gt;&lt;br /&gt;assert_raises(ExceptionType, func, *args, **kwargs)&lt;br /&gt;&lt;br /&gt;where the assert_raises function is something like:&lt;br /&gt;&lt;br /&gt;def assert_raises(t, func, *args, **kwargs):&lt;br /&gt;  try:&lt;br /&gt;    func(*args, **kwargs)&lt;br /&gt;    assert False, &amp;#39;%s not raised&amp;#39; % t&lt;br /&gt;  except t:&lt;br /&gt;    return&lt;br /&gt;  except:&lt;br /&gt;    raise&lt;br /&gt;&lt;br /&gt;But I can definitely see how macros could be useful, as well.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/5442858167903985181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/5442858167903985181'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1258555850911#c5442858167903985181' title=''/><author><name>rick</name><uri>http://www.blogger.com/profile/13530919414953298102</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-811511924'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-9016387120786177263</id><published>2009-11-17T23:57:13.523-05:00</published><updated>2009-11-17T23:57:13.523-05:00</updated><title type='text'>I&amp;#39;m just starting Python, and I already found ...</title><content type='html'>I&amp;#39;m just starting Python, and I already found a good use case for Macros.&lt;br /&gt;&lt;br /&gt;I want to run a test which is expected to raise an exception and write it like this:&lt;br /&gt;&lt;br /&gt;test-exn(&amp;quot;exception content&amp;quot;, func(args));&lt;br /&gt;&lt;br /&gt;Namely, I want this to expand to a try/catch statement without having to write the try/catch, and without having to write a class to encapsulate unit tests. These are for small scripts, but they&amp;#39;re large enough that I want to have a small bit of regression testing. Perhaps I&amp;#39;m writing a miniature interpreter...&lt;br /&gt;&lt;br /&gt;Lisp macros can (and do) do this.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/9016387120786177263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/9016387120786177263'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1258520233523#c9016387120786177263' title=''/><author><name>Jeremy</name><uri>http://www.blogger.com/profile/08041921049916424212</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-47483605'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-5761947483725414446</id><published>2009-11-07T18:16:37.322-05:00</published><updated>2009-11-07T18:16:37.322-05:00</updated><title type='text'>...and now I see MetaPython... nice work!   Don&amp;#3...</title><content type='html'>...and now I see MetaPython... nice work!   Don&amp;#39;t know if it&amp;#39;s enough to keep me in Python-land for the long-term, but definitely cool.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/5761947483725414446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/5761947483725414446'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1257635797322#c5761947483725414446' title=''/><author><name>cwells</name><uri>http://www.blogger.com/profile/06819587790275503111</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-778996615'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-6723711008864023403</id><published>2009-11-06T18:23:58.251-05:00</published><updated>2009-11-06T18:23:58.251-05:00</updated><title type='text'>The point of macros is that you can extend the lan...</title><content type='html'>The point of macros is that you can extend the language without cooperation from the core developers.   Consider the new Python &amp;quot;with&amp;quot; statement.   If Python had macros, not only could this have been implemented outside the core (rather than waiting for a committee to debate it for months), it could easily be backported to older versions of Python. &lt;br /&gt;&lt;br /&gt;Python has such a rich array of features precisely because it must. Since it&amp;#39;s impossible to extend the language in any significant sense, it must implement every useful feature it can.   Some of us think of this as &amp;quot;bloat&amp;quot;.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/6723711008864023403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/6723711008864023403'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1257549838251#c6723711008864023403' title=''/><author><name>cwells</name><uri>http://www.blogger.com/profile/06819587790275503111</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-778996615'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-824241147626562820</id><published>2009-03-16T16:55:00.000-04:00</published><updated>2009-03-16T16:55:00.000-04:00</updated><title type='text'>@Scott: I suppose I can see using macros to differ...</title><content type='html'>@Scott: I suppose I can see using macros to differentiate between debug and optimized code, although it looks like you have a passable workaround with simple Python conditionals.  It seems that a macro facility would probably make your "massive code project" code look cleaner (i.e. without the conditionals).&lt;BR/&gt;&lt;BR/&gt;Between that example and collections.namedtuple, I'm just about convinced that macros could add something to Python.  After reading the comments here, however, I am also convinced that Python needs them a lot less than a minimalist language like Lisp.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/824241147626562820'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/824241147626562820'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1237236900000#c824241147626562820' title=''/><author><name>Rick Copeland</name><uri>http://www.blogger.com/profile/11612114223288841087</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_nBbh7fCcv1w/SLBwYXLKA2I/AAAAAAAAABM/EgRC77lqhr0/S220/headshot_enhanced.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1701900629'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-3001818311929116593</id><published>2009-03-16T09:55:00.000-04:00</published><updated>2009-03-16T09:55:00.000-04:00</updated><title type='text'>Macros are great for conditionally ignoring a sect...</title><content type='html'>Macros are great for conditionally ignoring a section of code.  The one particular use I have in mind is for debug logging.  Our massive code project is littered with function calls to do debugging, protected by `if trace_level` conditionals to prevent evaluation of the function call and its (sometimes obscenely large) argument payload.  Two of the most expensive things one can do in Python are create objects and call functions, and logging generally does both.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/3001818311929116593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/3001818311929116593'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1237211700000#c3001818311929116593' title=''/><author><name>Scott Leerssen</name><uri>http://www.blogger.com/profile/14683805670948376813</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1625062918'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-7954532504510241758</id><published>2009-03-13T22:00:00.000-04:00</published><updated>2009-03-13T22:00:00.000-04:00</updated><title type='text'>Rick, it was good seeing you last night. I think P...</title><content type='html'>Rick, it was good seeing you last night. I think Python and Lisp are pretty close in terms of expressiveness. They have different philosophies though, and it attributes to why/how they are different. I much prefer Python's syntax to Lisp - code is generally much more pleasant to read, which is a big win. On the other hand, I like the simplicity of Lisp, in that there's just not that much to it. Macro's are so powerful you can do almost anything with it. On the other hand in Python, you have a large set of tools at your disposal(metaclasses, decorators, generators, the *with* clause, etc.). There's more you need to learn and more to chose from. Also, since they are language features, you can't extend them yourself - we have to design them by committee. Python wasn't always this expressive - It took many years to get to this point. Lispers were already enjoying their Macros almost at the beginning. Back then, there was nothing close to it, so it's no wonder they are so enthusiastic about them. Things are a bit different now - other languages have caught up.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/7954532504510241758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/7954532504510241758'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1236996000000#c7954532504510241758' title=''/><author><name>Toby Ho</name><uri>http://tobyho.com</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1710896542'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-1732024843455644722</id><published>2009-03-13T10:26:00.000-04:00</published><updated>2009-03-13T10:26:00.000-04:00</updated><title type='text'>@Zellyn:  I see what you&amp;#39;re saying, and I agre...</title><content type='html'>@Zellyn:  I see what you&amp;#39;re saying, and I agree that the type(...) approach can be off-putting, but I can also just write the following:&lt;BR/&gt;&lt;BR/&gt;class Test(BrowserTestCase):&lt;BR/&gt;    browser = browser&lt;BR/&gt;Test.__name__ = &amp;#39;Test%s&amp;#39; % browser&lt;BR/&gt;&lt;BR/&gt;In Python 2.6, I could even write a class decorator to clean it up:&lt;BR/&gt;&lt;BR/&gt;@setname(&amp;#39;Test%s&amp;#39; % browser)&lt;BR/&gt;class Test(BrowserTestCase):&lt;BR/&gt;    browser = browser&lt;BR/&gt;&lt;BR/&gt;where I have &lt;BR/&gt;&lt;BR/&gt;def setname(name):&lt;BR/&gt;    def inner(o):&lt;BR/&gt;        o.__name__ = name&lt;BR/&gt;        return o&lt;BR/&gt;    return inner&lt;BR/&gt;&lt;BR/&gt;Another thing I didn&amp;#39;t like about the type(...) approach is that it doesn&amp;#39;t account for metaclasses, but that&amp;#39;s a minor pet peeve.&lt;BR/&gt;&lt;BR/&gt;Actually, since you mentioned this, I can now think of a good use case for macros -- it would clean up the collections.namedtuple class generator quite a bit.  Right now, it puts together a string and eval()s it.  Kind of a poor man&amp;#39;s macro anyway.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/1732024843455644722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/1732024843455644722'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1236954360000#c1732024843455644722' title=''/><author><name>Rick Copeland</name><uri>http://www.blogger.com/profile/11612114223288841087</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_nBbh7fCcv1w/SLBwYXLKA2I/AAAAAAAAABM/EgRC77lqhr0/S220/headshot_enhanced.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1701900629'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-4953702925838673728</id><published>2009-03-13T10:15:00.000-04:00</published><updated>2009-03-13T10:15:00.000-04:00</updated><title type='text'>Macros allow your code-definition code to look mor...</title><content type='html'>Macros allow your code-definition code to look more like regular code.&lt;BR/&gt;&lt;BR/&gt;The type() example from last night&amp;#39;s PyATL meetup is a good example:&lt;BR/&gt;&lt;BR/&gt;class Test{BROWSER}(BrowserTestCase):&lt;BR/&gt; browser = {BROWSER}&lt;BR/&gt;&lt;BR/&gt;looks a lot more like a normal Python class definition than:&lt;BR/&gt;&lt;BR/&gt;type(&amp;quot;Test%s&amp;quot; %(CLASSNAME, BROWSER), (BrowserTestCase,), dict(browser=BROWSER))</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/4953702925838673728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/4953702925838673728'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1236953700000#c4953702925838673728' title=''/><author><name>Zellyn</name><uri>http://www.blogger.com/profile/07004628970214511962</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-304263012'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-2699665843027483019</id><published>2009-03-12T15:17:00.000-04:00</published><updated>2009-03-12T15:17:00.000-04:00</updated><title type='text'>I guess Lisp programmers when creating templating ...</title><content type='html'>I guess Lisp programmers when creating templating or configuration languages want to keep programming in Lisp plus a few additions, whereas Python programmers either need something completely different so that a few macros would not help them much anyway or if they want Python they want to stay as close as possible to its syntax.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/2699665843027483019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/2699665843027483019'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1236885420000#c2699665843027483019' title=''/><author><name>nes</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-568623848'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-7380757420970164649</id><published>2009-03-12T14:51:00.000-04:00</published><updated>2009-03-12T14:51:00.000-04:00</updated><title type='text'>Yeah, I suppose you could -- I like the idea of a ...</title><content type='html'>Yeah, I suppose you could -- I like the idea of a context manager approach -- in fact, I'll probably implement it that way sometime next week now that you point it out.&lt;BR/&gt;&lt;BR/&gt;I think the original point probably still stands though -- any where you have a set of boiler-plate code, it may be nice to have macro support.&lt;BR/&gt;&lt;BR/&gt;That said, as you've pointed out, it's nowhere near as important as in less flexible languages like C++!</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/7380757420970164649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/7380757420970164649'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1236883860000#c7380757420970164649' title=''/><author><name>chphilli</name><uri>http://www.blogger.com/profile/05755072772135183636</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1029977990'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-3729625048854763231</id><published>2009-03-12T13:57:00.000-04:00</published><updated>2009-03-12T13:57:00.000-04:00</updated><title type='text'>@chphilli: I kind of see what you&amp;#39;re saying, b...</title><content type='html'>@chphilli: I kind of see what you&amp;#39;re saying, but couldn&amp;#39;t you achieve the same thing with either a decorator (to guard a function) or a context manager (to guard an arbitrary block of code)?&lt;BR/&gt;&lt;BR/&gt;with logging_exceptions:&lt;BR/&gt;    some&lt;BR/&gt;    potentially&lt;BR/&gt;    exception&lt;BR/&gt;    raising&lt;BR/&gt;    stuff</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/3729625048854763231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/3729625048854763231'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1236880620000#c3729625048854763231' title=''/><author><name>Rick Copeland</name><uri>http://www.blogger.com/profile/11612114223288841087</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_nBbh7fCcv1w/SLBwYXLKA2I/AAAAAAAAABM/EgRC77lqhr0/S220/headshot_enhanced.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1701900629'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-820983470535643746</id><published>2009-03-12T12:37:00.000-04:00</published><updated>2009-03-12T12:37:00.000-04:00</updated><title type='text'>A coworker and I were just discussing this the oth...</title><content type='html'>A coworker and I were just discussing this the other day...&lt;BR/&gt;&lt;BR/&gt;In C++ development at my previous employment, we used macros all the time, to reduce repeated code patterns. The most common example was in exception handling, for example, catching, logging, and then re-throwing an exception.&lt;BR/&gt;&lt;BR/&gt;As I was writing "except Exception, e: ..." for yet another time the other day, I realized that with macros I could have avoided this repetition. Avoiding repetition means I only have to write it once, and thus, less potential for bugs!</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/820983470535643746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/820983470535643746'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1236875820000#c820983470535643746' title=''/><author><name>chphilli</name><uri>http://www.blogger.com/profile/05755072772135183636</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1029977990'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-5238807953366291245</id><published>2009-03-12T11:45:00.000-04:00</published><updated>2009-03-12T11:45:00.000-04:00</updated><title type='text'>@anonymous:  Not that I think it's a good idea, bu...</title><content type='html'>@anonymous:  Not that I think it's a good idea, but you can actually do that &lt;I&gt;without&lt;/I&gt; macros using &lt;A HREF="http://www.voidspace.org.uk/python/articles/metaclasses.shtml#the-selfless-metaclass" REL="nofollow"&gt;metaclasses&lt;/A&gt;.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/5238807953366291245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/5238807953366291245'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1236872700000#c5238807953366291245' title=''/><author><name>Rick Copeland</name><uri>http://www.blogger.com/profile/11612114223288841087</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_nBbh7fCcv1w/SLBwYXLKA2I/AAAAAAAAABM/EgRC77lqhr0/S220/headshot_enhanced.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1701900629'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-3734523356230357020</id><published>2009-03-12T11:41:00.000-04:00</published><updated>2009-03-12T11:41:00.000-04:00</updated><title type='text'>Macros could allow you to not use explicit self in...</title><content type='html'>Macros could allow you to not use explicit self in every class method...</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/3734523356230357020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/3734523356230357020'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1236872460000#c3734523356230357020' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1730724460'/></entry><entry><id>tag:blogger.com,1999:blog-18508356.post-7951963594330409993</id><published>2009-03-12T11:21:00.000-04:00</published><updated>2009-03-12T11:21:00.000-04:00</updated><title type='text'>I'm learning PLT Scheme right now and while the ID...</title><content type='html'>I'm learning PLT Scheme right now and while the IDE is quite cool, I don't see much point to macros either.&lt;BR/&gt;&lt;BR/&gt;I think macros could create idiosyncratic constructs, which not pythonic.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/7951963594330409993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/18508356/4718691580616017838/comments/default/7951963594330409993'/><link rel='alternate' type='text/html' href='http://blog.pythonisito.com/2009/03/python-macros.html?showComment=1236871260000#c7951963594330409993' title=''/><author><name>Sin</name><uri>http://www.blogger.com/profile/07775013906985712587</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.pythonisito.com/2009/03/python-macros.html' ref='tag:blogger.com,1999:blog-18508356.post-4718691580616017838' source='http://www.blogger.com/feeds/18508356/posts/default/4718691580616017838' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1763309672'/></entry></feed>
