<?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"
	>
<channel>
	<title>Comments on: Python impressions</title>
	<atom:link href="http://eli.thegreenplace.net/2008/06/06/python-impressions/feed/" rel="self" type="application/rss+xml" />
	<link>http://eli.thegreenplace.net/2008/06/06/python-impressions/</link>
	<description>Eli Bendersky's personal website</description>
	<pubDate>Fri, 21 Nov 2008 19:00:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: William</title>
		<link>http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122510</link>
		<dc:creator>William</dc:creator>
		<pubDate>Mon, 16 Jun 2008 00:39:51 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122510</guid>
		<description>', '.join(map(str, [1, 2, 3]))

is cuter still :)</description>
		<content:encoded><![CDATA[<p>&#8216;, &#8216;.join(map(str, [1, 2, 3]))</p>
<p>is cuter still <img src='http://eli.thegreenplace.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Antonio Ognio</title>
		<link>http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122213</link>
		<dc:creator>Antonio Ognio</dc:creator>
		<pubDate>Sat, 07 Jun 2008 20:05:32 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122213</guid>
		<description>This does not work:

&#62;&#62;&#62; ', '.join([1, 2, 3])
Traceback (most recent call last):
  File "", line 1, in 
TypeError: sequence item 0: expected string, int found

This works:

&#62;&#62;&#62; ', '.join( ['%d' % num for num in [1, 2, 3] ] )
'1, 2, 3'

In tha latter case you're joining a list of string elements that have been created using a list comprehension thus the join works.

Regards,

Antonio
Lima - Peru</description>
		<content:encoded><![CDATA[<p>This does not work:</p>
<p>&gt;&gt;&gt; &#8216;, &#8216;.join([1, 2, 3])<br />
Traceback (most recent call last):<br />
  File &#8220;&#8221;, line 1, in<br />
TypeError: sequence item 0: expected string, int found</p>
<p>This works:</p>
<p>&gt;&gt;&gt; &#8216;, &#8216;.join( ['%d' % num for num in [1, 2, 3] ] )<br />
&#8216;1, 2, 3&#8242;</p>
<p>In tha latter case you&#8217;re joining a list of string elements that have been created using a list comprehension thus the join works.</p>
<p>Regards,</p>
<p>Antonio<br />
Lima - Peru</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eliben</title>
		<link>http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122163</link>
		<dc:creator>eliben</dc:creator>
		<pubDate>Fri, 06 Jun 2008 19:49:25 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122163</guid>
		<description>Yoav: are you working ? are they using Linux at work ? If so, lucky you.

ripper: yeah, actually Ruby has this feature too. I think it's a bit confusing, because when you see code you thought you know its workings, it may surprise you because someone redefined the way some built-in class works.

njharman: private methods have their uses, in Python too. And I see a lot of Python code (stdlib included) with them.</description>
		<content:encoded><![CDATA[<p>Yoav: are you working ? are they using Linux at work ? If so, lucky you.</p>
<p>ripper: yeah, actually Ruby has this feature too. I think it&#8217;s a bit confusing, because when you see code you thought you know its workings, it may surprise you because someone redefined the way some built-in class works.</p>
<p>njharman: private methods have their uses, in Python too. And I see a lot of Python code (stdlib included) with them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Name</title>
		<link>http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122162</link>
		<dc:creator>Name</dc:creator>
		<pubDate>Fri, 06 Jun 2008 19:37:12 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122162</guid>
		<description>“Name: how do you write a 1-tuple ? isn’t that ugly ?
Whatever works for if, can work for unless too. It will make code more readable.
Can you elaborate on abstract classes that will solve the ‘join’ issue ?”

I write all tuples wrapped in parens, because it makes it easier for the human reader to distinguish them from function parameters. I also use trailing commas, because in multi-line tuples trailing commas reduce noise in diffs. However, the computer does not care; it would be equally as happy with any style:

a = 1,
a = (1,)
b = 1, 2, 3
b = 1, 2, 3,
b = (1, 2, 3,)

————————

Abstract base classes can provide default implementations of methods. For example, the sequence ABC can simply define a method join():

def join (self, sep):
  return sep.join (self)

and let [1, 2, 3].join (',') work the same as ','.join ([1, 2, 3]).</description>
		<content:encoded><![CDATA[<p>“Name: how do you write a 1-tuple ? isn’t that ugly ?<br />
Whatever works for if, can work for unless too. It will make code more readable.<br />
Can you elaborate on abstract classes that will solve the ‘join’ issue ?”</p>
<p>I write all tuples wrapped in parens, because it makes it easier for the human reader to distinguish them from function parameters. I also use trailing commas, because in multi-line tuples trailing commas reduce noise in diffs. However, the computer does not care; it would be equally as happy with any style:</p>
<p>a = 1,<br />
a = (1,)<br />
b = 1, 2, 3<br />
b = 1, 2, 3,<br />
b = (1, 2, 3,)</p>
<p>————————</p>
<p>Abstract base classes can provide default implementations of methods. For example, the sequence ABC can simply define a method join():</p>
<p>def join (self, sep):<br />
  return sep.join (self)</p>
<p>and let [1, 2, 3].join (&#8217;,') work the same as &#8216;,&#8217;.join ([1, 2, 3]).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ripper234</title>
		<link>http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122161</link>
		<dc:creator>ripper234</dc:creator>
		<pubDate>Fri, 06 Jun 2008 19:27:45 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122161</guid>
		<description>"len is a function and not a method"...

Sorry to introduce on this Python discussion, but I would just like to point out that C# 3.0 have this attractive feature - it allows one to add methods to existing classes.

Not happy with the the List class doesn't have join()? Write
string Join(List this, string seperator)
{
 return seperator.Join(this);
}

Back to watching Babylon 5 now, and again sorry if it's too off-topic.</description>
		<content:encoded><![CDATA[<p>&#8220;len is a function and not a method&#8221;&#8230;</p>
<p>Sorry to introduce on this Python discussion, but I would just like to point out that C# 3.0 have this attractive feature - it allows one to add methods to existing classes.</p>
<p>Not happy with the the List class doesn&#8217;t have join()? Write<br />
string Join(List this, string seperator)<br />
{<br />
 return seperator.Join(this);<br />
}</p>
<p>Back to watching Babylon 5 now, and again sorry if it&#8217;s too off-topic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: njharman</title>
		<link>http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122159</link>
		<dc:creator>njharman</dc:creator>
		<pubDate>Fri, 06 Jun 2008 18:51:56 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122159</guid>
		<description>Private methods are like curly brackets, getters setters and other OO purist cruft.  You soon realize they add little but more typing.  Other than __special__ methods I've not used private methods in a very very long time.  I almost never see them in mature Python code.  

Don't use them.</description>
		<content:encoded><![CDATA[<p>Private methods are like curly brackets, getters setters and other OO purist cruft.  You soon realize they add little but more typing.  Other than __special__ methods I&#8217;ve not used private methods in a very very long time.  I almost never see them in mature Python code.  </p>
<p>Don&#8217;t use them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: יואב</title>
		<link>http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122156</link>
		<dc:creator>יואב</dc:creator>
		<pubDate>Fri, 06 Jun 2008 18:25:17 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122156</guid>
		<description>מי מכריח אותך לעבוד בוינדוס ? תעבוד בלינוקס. פייתון מותקן בברירת מחדל ברוב הפצות הלינוקס.</description>
		<content:encoded><![CDATA[<p>מי מכריח אותך לעבוד בוינדוס ? תעבוד בלינוקס. פייתון מותקן בברירת מחדל ברוב הפצות הלינוקס.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Larry Clapp</title>
		<link>http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122155</link>
		<dc:creator>Larry Clapp</dc:creator>
		<pubDate>Fri, 06 Jun 2008 18:05:57 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122155</guid>
		<description>Interesting that roughly half of what you like is the language itself, and half the community and whatnot, whereas all of what you don't like is the language.  Not bad or good, just interesting.</description>
		<content:encoded><![CDATA[<p>Interesting that roughly half of what you like is the language itself, and half the community and whatnot, whereas all of what you don&#8217;t like is the language.  Not bad or good, just interesting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: beza1e1</title>
		<link>http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122152</link>
		<dc:creator>beza1e1</dc:creator>
		<pubDate>Fri, 06 Jun 2008 17:34:36 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122152</guid>
		<description>I think having 'join' in the str class actually makes sense. This way it works on all sequences (everything which has a __iter__ method) and you don't have to reimplement in in lists, dicts, sets, custom collections, ...</description>
		<content:encoded><![CDATA[<p>I think having &#8216;join&#8217; in the str class actually makes sense. This way it works on all sequences (everything which has a __iter__ method) and you don&#8217;t have to reimplement in in lists, dicts, sets, custom collections, &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manuel Montoya</title>
		<link>http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122151</link>
		<dc:creator>Manuel Montoya</dc:creator>
		<pubDate>Fri, 06 Jun 2008 16:55:16 +0000</pubDate>
		<guid isPermaLink="false">http://eli.thegreenplace.net/2008/06/06/python-impressions/#comment-122151</guid>
		<description>If you use MS Windows  (and let 30% of your RAM is wasted in antivirus cycles) obviously you don't have any authority to write about good technologies.</description>
		<content:encoded><![CDATA[<p>If you use MS Windows  (and let 30% of your RAM is wasted in antivirus cycles) obviously you don&#8217;t have any authority to write about good technologies.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
