<?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: A foolish consistency, etc</title>
	<atom:link href="http://4.flowsnake.org/archives/122/feed" rel="self" type="application/rss+xml" />
	<link>http://4.flowsnake.org/archives/122</link>
	<description>A Pythoneer's adventures with Chicken Scheme. ^_^ And more.</description>
	<pubDate>Tue, 06 Jan 2009 19:51:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
		<item>
		<title>By: rgz</title>
		<link>http://4.flowsnake.org/archives/122#comment-328</link>
		<dc:creator>rgz</dc:creator>
		<pubDate>Thu, 19 Jun 2008 23:08:10 +0000</pubDate>
		<guid isPermaLink="false">http://4.flowsnake.org/?p=122#comment-328</guid>
		<description>While I agree that python is being overly conservative and that list should have a length (and a join) method, the reason that Python sequences lack a length method is due to the fact that, length methods are so easy to create in an easy and standarised way that it really does not make sense to write a length method for every sequence ever and yet there is no way to make sure that every sequence will have a length method. Let me elaborate...

One of the coolest methods in python is __getitem__ the reason it is so is because by overriding this hook and object gets access to special  syntax like &#62;&#62;&#62;item['retrieving'] and &#62;&#62;&#62;for iterating in them: and also... length retrieving.

I'm not gonna write it here but its fairly easy to write a __len__ method if an object supports __getitem__, its boilerplate code.

 And because it's boilerplate code, it got factored into the len() function.

it would actually make more sense to factor this function as a method of some BaseSequence class and let the object inherit it from there but the function was easier to implement as a standalone function and so it was done that way. IT IS OLDSCHOOLED but in my opinion it doesn't illustrate that python isn't OO but that Python needed a Sequence base class and enforcing using that class and it failed to do so.</description>
		<content:encoded><![CDATA[<p>While I agree that python is being overly conservative and that list should have a length (and a join) method, the reason that Python sequences lack a length method is due to the fact that, length methods are so easy to create in an easy and standarised way that it really does not make sense to write a length method for every sequence ever and yet there is no way to make sure that every sequence will have a length method. Let me elaborate...</p>
<p>One of the coolest methods in python is __getitem__ the reason it is so is because by overriding this hook and object gets access to special  syntax like &gt;&gt;&gt;item['retrieving'] and &gt;&gt;&gt;for iterating in them: and also... length retrieving.</p>
<p>I'm not gonna write it here but its fairly easy to write a __len__ method if an object supports __getitem__, its boilerplate code.</p>
<p> And because it's boilerplate code, it got factored into the len() function.</p>
<p>it would actually make more sense to factor this function as a method of some BaseSequence class and let the object inherit it from there but the function was easier to implement as a standalone function and so it was done that way. IT IS OLDSCHOOLED but in my opinion it doesn't illustrate that python isn't OO but that Python needed a Sequence base class and enforcing using that class and it failed to do so.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Cowan</title>
		<link>http://4.flowsnake.org/archives/122#comment-326</link>
		<dc:creator>John Cowan</dc:creator>
		<pubDate>Thu, 19 Jun 2008 17:39:57 +0000</pubDate>
		<guid isPermaLink="false">http://4.flowsnake.org/?p=122#comment-326</guid>
		<description>De facto len() is a method, in the sense that its behavior is polymorphic.  It just can't be called with the syntax of a method, which is a wart, but what languages are without warts (except Scheme?)</description>
		<content:encoded><![CDATA[<p>De facto len() is a method, in the sense that its behavior is polymorphic.  It just can't be called with the syntax of a method, which is a wart, but what languages are without warts (except Scheme?)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
