<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Five things I hate about Python</title>
	<atom:link href="http://dougma.com/archives/21/feed" rel="self" type="application/rss+xml" />
	<link>http://dougma.com/archives/21</link>
	<description>the truth according to Doug</description>
	<lastBuildDate>Mon, 05 Sep 2011 01:44:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: Five things I hate about Python-- Greg and Kat&#8217;s blog</title>
		<link>http://dougma.com/archives/21/comment-page-1#comment-33</link>
		<dc:creator>Five things I hate about Python-- Greg and Kat&#8217;s blog</dc:creator>
		<pubDate>Wed, 30 Jan 2008 05:15:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.dougma.com/?p=16#comment-33</guid>
		<description>[...] seems most common among the Python crowd: Python 2, Python 3, Python 4. It&#8217;s probably because everybody loves Python. But, I did manage to find a few others: C, [...]</description>
		<content:encoded><![CDATA[<p>[...] seems most common among the Python crowd: Python 2, Python 3, Python 4. It&#8217;s probably because everybody loves Python. But, I did manage to find a few others: C, [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: doug</title>
		<link>http://dougma.com/archives/21/comment-page-1#comment-25</link>
		<dc:creator>doug</dc:creator>
		<pubDate>Mon, 07 May 2007 00:29:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.dougma.com/?p=16#comment-25</guid>
		<description>Grammaman (or Grammar Man?):

    (Is that you Joev?)

   Thanks, I will make every attempt not to make that mistake again; (I have made it a whopping 38 times already.) I make no secret of the fact that I can not spell to save my life.</description>
		<content:encoded><![CDATA[<p>Grammaman (or Grammar Man?):</p>
<p>    (Is that you Joev?)</p>
<p>   Thanks, I will make every attempt not to make that mistake again; (I have made it a whopping 38 times already.) I make no secret of the fact that I can not spell to save my life.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grammaman</title>
		<link>http://dougma.com/archives/21/comment-page-1#comment-24</link>
		<dc:creator>Grammaman</dc:creator>
		<pubDate>Mon, 07 May 2007 00:12:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.dougma.com/?p=16#comment-24</guid>
		<description>&lt;b&gt;allot&lt;/b&gt;
-verb
   to divide or distribute by share or portion; distribute or parcel out; apportion: to allot the available farmland among the settlers.

&lt;b&gt;a lot&lt;/b&gt;
-adverb
   to a very great degree or extent; &quot;I feel a lot better&quot;</description>
		<content:encoded><![CDATA[<p><b>allot</b><br />
-verb<br />
   to divide or distribute by share or portion; distribute or parcel out; apportion: to allot the available farmland among the settlers.</p>
<p><b>a lot</b><br />
-adverb<br />
   to a very great degree or extent; &#8220;I feel a lot better&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: doug</title>
		<link>http://dougma.com/archives/21/comment-page-1#comment-32</link>
		<dc:creator>doug</dc:creator>
		<pubDate>Sat, 05 May 2007 03:19:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.dougma.com/?p=16#comment-32</guid>
		<description>Brett:

I really should have done better research on #1, as it seams I missed many things. I knew about PEP 362, but was not up to speed on the work done on it. I thought it was going to be rejected (from early dev chatter back in October). I haven&#039;t kept up much with the dev work since then. It&#039;s good to hear that there is a sandbox implementation which works with annotations. I will try to get back up to speed on this.

On the compiling of .pyc/.pyo files, if you write a custom compiler you can enforce that the __file__ is set to an absolute path. This is what we are currently doing, but without your import extensions and bootstrapping, you still need to compile to the same directory as the .py. I Don&#039;t think you really need two directories on the path, you can have one directory for the .py files, and then as part of the custom import, before doing the compile step, first extend the search to that files directory + say a directory with the python version number. This is they type of hack that is not possible with the current import hook.</description>
		<content:encoded><![CDATA[<p>Brett:</p>
<p>I really should have done better research on #1, as it seams I missed many things. I knew about PEP 362, but was not up to speed on the work done on it. I thought it was going to be rejected (from early dev chatter back in October). I haven&#8217;t kept up much with the dev work since then. It&#8217;s good to hear that there is a sandbox implementation which works with annotations. I will try to get back up to speed on this.</p>
<p>On the compiling of .pyc/.pyo files, if you write a custom compiler you can enforce that the __file__ is set to an absolute path. This is what we are currently doing, but without your import extensions and bootstrapping, you still need to compile to the same directory as the .py. I Don&#8217;t think you really need two directories on the path, you can have one directory for the .py files, and then as part of the custom import, before doing the compile step, first extend the search to that files directory + say a directory with the python version number. This is they type of hack that is not possible with the current import hook.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brett</title>
		<link>http://dougma.com/archives/21/comment-page-1#comment-31</link>
		<dc:creator>Brett</dc:creator>
		<pubDate>Fri, 04 May 2007 22:28:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.dougma.com/?p=16#comment-31</guid>
		<description>PEP 362 (function signature objects) was partially motivated by decorators that hid details of the wrapped function.  The hope was that introspection tools would use the signature object instead of what was on the function and thus ignore the typical decorator&#039;s ``*args, **kwargs`` signature.

As for #4, I think you right that my import stuff will help.  You can probably get away with having two entries on sys.path (one for the .py files, the other for the .pyc/.pyo files).  You then have a custom handler for the loader that deals with the. py files that knows to write out all .pyc/.pyo files to the other directory.  A custom loader for the .pyc/.pyo files would also be needed to set __file__ properly for the exceptions (I think that is all .pyc files need).

Then again, .pyc/.pyo files need a redesign.  They really should be merged into a single format and probably contain metadata that specifies what file it was created from so that this is all much simpler.</description>
		<content:encoded><![CDATA[<p>PEP 362 (function signature objects) was partially motivated by decorators that hid details of the wrapped function.  The hope was that introspection tools would use the signature object instead of what was on the function and thus ignore the typical decorator&#8217;s &#8220;*args, **kwargs&#8220; signature.</p>
<p>As for #4, I think you right that my import stuff will help.  You can probably get away with having two entries on sys.path (one for the .py files, the other for the .pyc/.pyo files).  You then have a custom handler for the loader that deals with the. py files that knows to write out all .pyc/.pyo files to the other directory.  A custom loader for the .pyc/.pyo files would also be needed to set __file__ properly for the exceptions (I think that is all .pyc files need).</p>
<p>Then again, .pyc/.pyo files need a redesign.  They really should be merged into a single format and probably contain metadata that specifies what file it was created from so that this is all much simpler.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: doug</title>
		<link>http://dougma.com/archives/21/comment-page-1#comment-30</link>
		<dc:creator>doug</dc:creator>
		<pubDate>Fri, 04 May 2007 15:50:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.dougma.com/?p=16#comment-30</guid>
		<description>Peter:
    Yup! thats exactly what I want, and you have no Idea how happy I am someone else also came up with a solution! I don&#039;t know how I missed you module before! I am going to go with the excuse that I came up with a solution for myself back in 2005 and haven&#039;t bothered looking that hard since then ;-) (NOTE: Peter&#039;s solution looks like it was released before I started working on my own.)

For Py3K we really need this functionality builtin. Interested on working on a PEP together?</description>
		<content:encoded><![CDATA[<p>Peter:<br />
    Yup! thats exactly what I want, and you have no Idea how happy I am someone else also came up with a solution! I don&#8217;t know how I missed you module before! I am going to go with the excuse that I came up with a solution for myself back in 2005 and haven&#8217;t bothered looking that hard since then <img src='http://dougma.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  (NOTE: Peter&#8217;s solution looks like it was released before I started working on my own.)</p>
<p>For Py3K we really need this functionality builtin. Interested on working on a PEP together?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: doug</title>
		<link>http://dougma.com/archives/21/comment-page-1#comment-29</link>
		<dc:creator>doug</dc:creator>
		<pubDate>Fri, 04 May 2007 15:29:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.dougma.com/?p=16#comment-29</guid>
		<description>Translated:

The threading was just an example of a common decorator which does not change the argument spec  of the function it decorates, but by decorating it, you loose that argument spec which is used by help, doc generate, and other decorators like those in the functools module.

Peter:

Yes I know about the decorator module, and I have my own version of it. The problem is those calls do not do what this one does:
&lt;a href=&quot;http://derivin.addr.com/pycon2006/dec1.py&quot; rel=&quot;nofollow&quot;&gt;http://derivin.addr.com/pycon2006/dec1.py&lt;/a&gt;

Which is preserve the argument spec of the original function or method. If the origional has &#039;def foo(a, b, c=None)&#039; in module &#039;testing&#039; then I want all that information on the wrapped version preserved &lt;i&gt;(And no Brett, I do not want nor support tuple arguments, they suck)&lt;/i&gt;.

&lt;strong&gt;UPDATE: I AM WRONG. I does exactly what I want!&lt;/strong&gt;

&lt;pre&gt;
&lt;strike&gt;@clone_definition(threadsafe)&lt;/strike&gt;
&lt;strike&gt;@clone_definition(print_hello)&lt;/strike&gt;
@decorator.decorator(threadsafe)
@decorator.decorator(print_hello)
def myfunc(a, b, c=None):
   &#039;&#039;&#039;documentation&#039;&#039;&#039;
   print a, b, c

&gt;&gt;&gt; help(myfunc)
Help on function myfunc in module testing:
myfunc(a, b, c=None)
    documentation

&gt;&gt;&gt; myfunc(1,2,3)
acquiring...
hello
1 2 3
releasing...
&gt;&gt;&gt;
&lt;/pre&gt;

I want the function name, module and arguments to be preserved while still being wrapped.

Simon:

I know about this module and the first function proposed for it was the decorator decorator, which did what I wanted (but in a way thata sometimes crashed, didn&#039;t support default args, and had major problems with tuple arguments).

&lt;pre&gt;
&gt;&gt;&gt; def dec(f):
...   @functools.wraps(f)
...   def wrap(*args, **kwds):
...     print &quot;Hello&quot;
...     return f(*args, **kwdargs)
...   return wrap
...
&gt;&gt;&gt; @dec
... def foo(a, b, c=None):
...   &quot;&quot;&quot;doc string&quot;&quot;&quot;
...   print a,b,c
...
&gt;&gt;&gt; help(foo)
Help on function foo in module __main__:

foo(*args, **kwds)
    doc string

&gt;&gt;&gt;
&lt;/pre&gt;

Not &lt;em&gt;quite&lt;/em&gt; good enough. I want to see my argument names and default args.  With the advent of function annotations, this problem will be compounded. Annotations will be used for interesting things like adding strong(ish) typing, argument validation, more interesting functools, WDSL generation (*shiver*), and rich documentation. If adding a pass through decorator removed the annotations, things will break. That will be unacceptable to many people.</description>
		<content:encoded><![CDATA[<p>Translated:</p>
<p>The threading was just an example of a common decorator which does not change the argument spec  of the function it decorates, but by decorating it, you loose that argument spec which is used by help, doc generate, and other decorators like those in the functools module.</p>
<p>Peter:</p>
<p>Yes I know about the decorator module, and I have my own version of it. The problem is those calls do not do what this one does:<br />
<a href="http://derivin.addr.com/pycon2006/dec1.py" rel="nofollow">http://derivin.addr.com/pycon2006/dec1.py</a></p>
<p>Which is preserve the argument spec of the original function or method. If the origional has &#8216;def foo(a, b, c=None)&#8217; in module &#8216;testing&#8217; then I want all that information on the wrapped version preserved <i>(And no Brett, I do not want nor support tuple arguments, they suck)</i>.</p>
<p><strong>UPDATE: I AM WRONG. I does exactly what I want!</strong></p>
<pre>
<strike>@clone_definition(threadsafe)</strike>
<strike>@clone_definition(print_hello)</strike>
@decorator.decorator(threadsafe)
@decorator.decorator(print_hello)
def myfunc(a, b, c=None):
   '''documentation'''
   print a, b, c

&gt;&gt;&gt; help(myfunc)
Help on function myfunc in module testing:
myfunc(a, b, c=None)
    documentation

&gt;&gt;&gt; myfunc(1,2,3)
acquiring...
hello
1 2 3
releasing...
&gt;&gt;&gt;
</pre>
<p>I want the function name, module and arguments to be preserved while still being wrapped.</p>
<p>Simon:</p>
<p>I know about this module and the first function proposed for it was the decorator decorator, which did what I wanted (but in a way thata sometimes crashed, didn&#8217;t support default args, and had major problems with tuple arguments).</p>
<pre>
>>> def dec(f):
...   @functools.wraps(f)
...   def wrap(*args, **kwds):
...     print "Hello"
...     return f(*args, **kwdargs)
...   return wrap
...
&gt;&gt;&gt; @dec
... def foo(a, b, c=None):
...   """doc string"""
...   print a,b,c
...
&gt;&gt;&gt; help(foo)
Help on function foo in module __main__:

foo(*args, **kwds)
    doc string

&gt;&gt;&gt;
</pre>
<p>Not <em>quite</em> good enough. I want to see my argument names and default args.  With the advent of function annotations, this problem will be compounded. Annotations will be used for interesting things like adding strong(ish) typing, argument validation, more interesting functools, WDSL generation (*shiver*), and rich documentation. If adding a pass through decorator removed the annotations, things will break. That will be unacceptable to many people.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://dougma.com/archives/21/comment-page-1#comment-28</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Fri, 04 May 2007 14:09:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.dougma.com/?p=16#comment-28</guid>
		<description>What about functools.wraps() for the &quot;decorators are lossy&quot; problem?

&lt;a href=&quot;http://docs.python.org/lib/module-functools.html#l2h-1069&quot; title=&quot;functools.wraps()&quot; rel=&quot;nofollow&quot;&gt;</description>
		<content:encoded><![CDATA[<p>What about functools.wraps() for the &#8220;decorators are lossy&#8221; problem?</p>
<p><a href="http://docs.python.org/lib/module-functools.html#l2h-1069" title="functools.wraps()" rel="nofollow"></a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Fein</title>
		<link>http://dougma.com/archives/21/comment-page-1#comment-27</link>
		<dc:creator>Peter Fein</dc:creator>
		<pubDate>Fri, 04 May 2007 13:03:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.dougma.com/?p=16#comment-27</guid>
		<description>You know about the &lt;a href=&quot;http://www.phyast.pitt.edu/~micheles/python/documentation.html&quot; rel=&quot;nofollow&quot;&gt;decorator&lt;/a&gt; module, right?  It handles exactly that problem.

Dunno if you mentioned it or not, I got lost in all the ranting. ;-)</description>
		<content:encoded><![CDATA[<p>You know about the <a href="http://www.phyast.pitt.edu/~micheles/python/documentation.html" rel="nofollow">decorator</a> module, right?  It handles exactly that problem.</p>
<p>Dunno if you mentioned it or not, I got lost in all the ranting. <img src='http://dougma.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: translated</title>
		<link>http://dougma.com/archives/21/comment-page-1#comment-26</link>
		<dc:creator>translated</dc:creator>
		<pubDate>Fri, 04 May 2007 12:23:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.dougma.com/?p=16#comment-26</guid>
		<description>Hey there. I agree with the exit bit. didn&#039;t quite get the thread part. The &quot;mind blowing&quot; technology looks pretty awesome, they should spend a tad more money on advertising though, the one with the joggers was a little lame ;-)</description>
		<content:encoded><![CDATA[<p>Hey there. I agree with the exit bit. didn&#8217;t quite get the thread part. The &#8220;mind blowing&#8221; technology looks pretty awesome, they should spend a tad more money on advertising though, the one with the joggers was a little lame <img src='http://dougma.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

