<?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 for Sean Middleditch</title>
	<atom:link href="http://blogs.awesomeplay.com/elanthis/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.awesomeplay.com/elanthis</link>
	<description>The Web: where else could I publish this crap?</description>
	<pubDate>Thu, 21 Aug 2008 17:40:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>Comment on Python Annoyances by Sean Middleditch</title>
		<link>http://blogs.awesomeplay.com/elanthis/archives/2008/07/31/468/#comment-5619</link>
		<dc:creator>Sean Middleditch</dc:creator>
		<pubDate>Sat, 16 Aug 2008 14:46:36 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.awesomeplay.com/elanthis/?p=468#comment-5619</guid>
		<description>Lennart, I'm done.  You can't seem to get it into your head that I do not need help adjusting to dynamic languages, nor can you get it into your head that I'm not even arguing against dynamic features.  Declaring member variables in the class, for example, in no way requires that you stop allowing dynamic member assignment.  I'd like to be able to disable that for classes I know don't need it (and I already can), but that's a separate issue from just making class definitions easier to read and easier to document.

This discussion (not that it actually has been one) is over.</description>
		<content:encoded><![CDATA[<p>Lennart, I&#8217;m done.  You can&#8217;t seem to get it into your head that I do not need help adjusting to dynamic languages, nor can you get it into your head that I&#8217;m not even arguing against dynamic features.  Declaring member variables in the class, for example, in no way requires that you stop allowing dynamic member assignment.  I&#8217;d like to be able to disable that for classes I know don&#8217;t need it (and I already can), but that&#8217;s a separate issue from just making class definitions easier to read and easier to document.</p>
<p>This discussion (not that it actually has been one) is over.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Annoyances by Lennart Regebro</title>
		<link>http://blogs.awesomeplay.com/elanthis/archives/2008/07/31/468/#comment-5618</link>
		<dc:creator>Lennart Regebro</dc:creator>
		<pubDate>Sat, 16 Aug 2008 09:04:09 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.awesomeplay.com/elanthis/?p=468#comment-5618</guid>
		<description>(3) This is a form of dynamicness. Not only are the type of a variable dynamic, which attributes an instance has is dynamic as well. Your argument against this is just a variation of the standard argument against dynamic typing, and this, just as all forms of dynamic typing, has shows itself to not be a problem in practice. I realize arguing against you in this will make you more determined never to like this, but I hope that others reading this will understand and not be afraid of dynamicness in languages.

(5) "All I want to do is move the error to parse time."

Fair enough. But this does not require specific syntax for definitions than assignments. Also, you can instead run pyflakes or similar as a part of your testing procedure, and it will also find most of these these errors before you actually encounter them. If you constantly find yourself assigning variables that already exist, and you really want variable definitions in the beginning of a method (I suspect this desire laso just is a part of you not being used to it), the pleas, go ahead and do so if you want. Nothing stops you.

You still want to have a language which hand you have to hold. But the things you percieve as problems are not problems in practice. Your suggestions only requires more syntax and opens up for more errors. Sure, the language will detect these errors quickly, but programming will be slower.

"There are already languages that do it that way!"

I've never said it's impossible. I'm just saying that the befits you percieve aren't really there.


Honestly, it's just a matter of getting used to not having to babysit a compiler. Again, I've seen this before.</description>
		<content:encoded><![CDATA[<p>(3) This is a form of dynamicness. Not only are the type of a variable dynamic, which attributes an instance has is dynamic as well. Your argument against this is just a variation of the standard argument against dynamic typing, and this, just as all forms of dynamic typing, has shows itself to not be a problem in practice. I realize arguing against you in this will make you more determined never to like this, but I hope that others reading this will understand and not be afraid of dynamicness in languages.</p>
<p>(5) &#8220;All I want to do is move the error to parse time.&#8221;</p>
<p>Fair enough. But this does not require specific syntax for definitions than assignments. Also, you can instead run pyflakes or similar as a part of your testing procedure, and it will also find most of these these errors before you actually encounter them. If you constantly find yourself assigning variables that already exist, and you really want variable definitions in the beginning of a method (I suspect this desire laso just is a part of you not being used to it), the pleas, go ahead and do so if you want. Nothing stops you.</p>
<p>You still want to have a language which hand you have to hold. But the things you percieve as problems are not problems in practice. Your suggestions only requires more syntax and opens up for more errors. Sure, the language will detect these errors quickly, but programming will be slower.</p>
<p>&#8220;There are already languages that do it that way!&#8221;</p>
<p>I&#8217;ve never said it&#8217;s impossible. I&#8217;m just saying that the befits you percieve aren&#8217;t really there.</p>
<p>Honestly, it&#8217;s just a matter of getting used to not having to babysit a compiler. Again, I&#8217;ve seen this before.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Annoyances by Sean Middleditch</title>
		<link>http://blogs.awesomeplay.com/elanthis/archives/2008/07/31/468/#comment-5617</link>
		<dc:creator>Sean Middleditch</dc:creator>
		<pubDate>Thu, 14 Aug 2008 15:29:04 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.awesomeplay.com/elanthis/?p=468#comment-5617</guid>
		<description>Hey Lennart,

I guess we'll just have to disagree about (2).  I hate it.

For (3), once again you fail to understand that it has NOTHING to do with dynamicness. PHP is also fully dynamic but allows you to declare instance members with initializers in the class.  And it's way more readable.  And it makes way easier to write documentation tool chains that documents which instance members exist, their purpose, their expected types, and so on, which does actually matter.  If you don't think so, ask yourself what happens on a class that has a method which calls another method on an instance member would do if you didn't set that instance member to a compatible type: it'd throw an exception that the method shouldn't throw, and you'd be left scratching your head trying to figure out why because the docs don't in any way indicate that the instance member needs to exist, that it needs to be of a certain type (or compatible with the type, at least), etc.  Lame.

For (5), no, it once again is not about types.  Come on, this shouldn't need explanation.  Python ALREADY DOES THIS to an extent: if you try to use a variable that doesn't exist, you get a runtime exception.  All I want to do is move the error to parse time.  I have NEVER in my life had any kind of problem with needing to move declarations around; you're just making up theoretical problems that don't in reality actually exist.  If you're moving code around that often, you need to step away from the computer for a minute and try to think before you write code.  I don't know about you, but I'd tend to prefer to write code once and move on to doing new things rather than rearranging incomplete code over and over and over just because I was too damn lazy or incompetent to do it right the first time.

For (6), you confuse "required" with "standard."  English, it works.

And dude, seriously, stop telling me I'll get used to dynamic typing.  I've been using dynamically typed languages for more years than some of the core Python folks have been using computers at all.  YOU are the one who is confused here since you can't seem to differentiate between dynamic/static typing and structure.  Totally different things.

I mean, by your logic, Python has no use for classes at all.  They serve no purpose.  They're needless complexity when Python could have just gone with a prototype model like JavaScript.  Why define methods in a class at all when you can just add methods to the class?  Why have a class at all when all a class is is just an object that holds class members and methods?  Classes are there for a reason: for structure.

Types DO matter, even in a dynamic world, because you can't call the someOtherClassMethod() on an object that doesn't and never will have that method.

Structure does matter because the computer doesn't have a fucking clue WHY I'm telling it anything; it only knows what I tell it.  The computer doesn't necessarily need to know why I'm telling it to do things, but other programmers reading my code do, and structure makes it easier for them to read it without requiring 30 line comments all over the place pointing to 20 different places because the language doesn't make it possible to organize efficiently.

I mean, take the instance member definition issue.  Sure, I can put them all in the __init__ method and document that.  But that is harder to read, and you're full of crap if you think otherwise.  Why does Python force indentation?  For readability.  What happens when you put instance member initializers at the same indentation level as method bodies?  They end up looking the damn same, making it just that much harder to find what you're looking for.

You don't have to remove dynamicness to make it freaking possible to define instance methods and initializers in a cleaner format.  Seriously.

You also can still make it possible to disable dynamicness in some instances where the programmer actually knows better than the damn language (*gasp*!) and knows that one of the classes he is defining is not going to be used by external libraries, third-party code, or anything other than the sole specific purpose he defined that class for, and he knows that he does not want to allow dynamicness because it's just a source of bugs with absolutely no fucking benefits in this particular case.

It's not one or the other.  It can be both.  Really.  There are already languages that do it that way!  Please stop thinking of everything as either Python or Java, because those are just two little denizens within the very, very large world of programming languages.</description>
		<content:encoded><![CDATA[<p>Hey Lennart,</p>
<p>I guess we&#8217;ll just have to disagree about (2).  I hate it.</p>
<p>For (3), once again you fail to understand that it has NOTHING to do with dynamicness. PHP is also fully dynamic but allows you to declare instance members with initializers in the class.  And it&#8217;s way more readable.  And it makes way easier to write documentation tool chains that documents which instance members exist, their purpose, their expected types, and so on, which does actually matter.  If you don&#8217;t think so, ask yourself what happens on a class that has a method which calls another method on an instance member would do if you didn&#8217;t set that instance member to a compatible type: it&#8217;d throw an exception that the method shouldn&#8217;t throw, and you&#8217;d be left scratching your head trying to figure out why because the docs don&#8217;t in any way indicate that the instance member needs to exist, that it needs to be of a certain type (or compatible with the type, at least), etc.  Lame.</p>
<p>For (5), no, it once again is not about types.  Come on, this shouldn&#8217;t need explanation.  Python ALREADY DOES THIS to an extent: if you try to use a variable that doesn&#8217;t exist, you get a runtime exception.  All I want to do is move the error to parse time.  I have NEVER in my life had any kind of problem with needing to move declarations around; you&#8217;re just making up theoretical problems that don&#8217;t in reality actually exist.  If you&#8217;re moving code around that often, you need to step away from the computer for a minute and try to think before you write code.  I don&#8217;t know about you, but I&#8217;d tend to prefer to write code once and move on to doing new things rather than rearranging incomplete code over and over and over just because I was too damn lazy or incompetent to do it right the first time.</p>
<p>For (6), you confuse &#8220;required&#8221; with &#8220;standard.&#8221;  English, it works.</p>
<p>And dude, seriously, stop telling me I&#8217;ll get used to dynamic typing.  I&#8217;ve been using dynamically typed languages for more years than some of the core Python folks have been using computers at all.  YOU are the one who is confused here since you can&#8217;t seem to differentiate between dynamic/static typing and structure.  Totally different things.</p>
<p>I mean, by your logic, Python has no use for classes at all.  They serve no purpose.  They&#8217;re needless complexity when Python could have just gone with a prototype model like JavaScript.  Why define methods in a class at all when you can just add methods to the class?  Why have a class at all when all a class is is just an object that holds class members and methods?  Classes are there for a reason: for structure.</p>
<p>Types DO matter, even in a dynamic world, because you can&#8217;t call the someOtherClassMethod() on an object that doesn&#8217;t and never will have that method.</p>
<p>Structure does matter because the computer doesn&#8217;t have a fucking clue WHY I&#8217;m telling it anything; it only knows what I tell it.  The computer doesn&#8217;t necessarily need to know why I&#8217;m telling it to do things, but other programmers reading my code do, and structure makes it easier for them to read it without requiring 30 line comments all over the place pointing to 20 different places because the language doesn&#8217;t make it possible to organize efficiently.</p>
<p>I mean, take the instance member definition issue.  Sure, I can put them all in the __init__ method and document that.  But that is harder to read, and you&#8217;re full of crap if you think otherwise.  Why does Python force indentation?  For readability.  What happens when you put instance member initializers at the same indentation level as method bodies?  They end up looking the damn same, making it just that much harder to find what you&#8217;re looking for.</p>
<p>You don&#8217;t have to remove dynamicness to make it freaking possible to define instance methods and initializers in a cleaner format.  Seriously.</p>
<p>You also can still make it possible to disable dynamicness in some instances where the programmer actually knows better than the damn language (*gasp*!) and knows that one of the classes he is defining is not going to be used by external libraries, third-party code, or anything other than the sole specific purpose he defined that class for, and he knows that he does not want to allow dynamicness because it&#8217;s just a source of bugs with absolutely no fucking benefits in this particular case.</p>
<p>It&#8217;s not one or the other.  It can be both.  Really.  There are already languages that do it that way!  Please stop thinking of everything as either Python or Java, because those are just two little denizens within the very, very large world of programming languages.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Annoyances by Lennart Regebro</title>
		<link>http://blogs.awesomeplay.com/elanthis/archives/2008/07/31/468/#comment-5611</link>
		<dc:creator>Lennart Regebro</dc:creator>
		<pubDate>Wed, 06 Aug 2008 06:44:20 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.awesomeplay.com/elanthis/?p=468#comment-5611</guid>
		<description>2. No it's not.

3. Right, the difference between class members and instance members means you can't set mutable objects like this, that's true. I read what you arite again, and your complaint is really that you can't just look at the top of the class definition to see it's members because of this. Again, Python is dynamic. Once you have gotten used to that, you'll love it.

5. Yes it has to do with static typing, since variable declaration is pointless unless they have a static type. Now you say you want something to declare that this is the first time a variable is used. That means that the first time you assign to a variable, you have to write something extra there. Say:
     define foo = "345"
and the next time you assign foo you just write:
     foo = "76767"
But if you now remove the first assignment, then the second one would fail. And if you insert a "define foo = None" before the first "define foo", then that would fail. You now have a lot of "define" statements you have to move around and get in the correct place. For absolutely no reason.


6. So you want a required formatting that isn't required. Hoookay...


"I’m not saying I want static typing."

Yeah, that's in fact exactly what you are saying. But you'll get used to dynamic typing soon enough. Most of your complaints are the same reaction that I had when switching to python, and I've seen it happen in several of my friends too, when I've convinced them to try out Python. It goes away.

You call it "helping you do do your job", I call it "forcing you to go through useless hoops". You call it holding the languages hand. Well, I think it's the other way around. When I need to constantly tell the language everything. What type everything should be, when a variable is declared for the first time, etc. Why should I tell it these things? It already *knows*! THAT is holding the languages hand.</description>
		<content:encoded><![CDATA[<p>2. No it&#8217;s not.</p>
<p>3. Right, the difference between class members and instance members means you can&#8217;t set mutable objects like this, that&#8217;s true. I read what you arite again, and your complaint is really that you can&#8217;t just look at the top of the class definition to see it&#8217;s members because of this. Again, Python is dynamic. Once you have gotten used to that, you&#8217;ll love it.</p>
<p>5. Yes it has to do with static typing, since variable declaration is pointless unless they have a static type. Now you say you want something to declare that this is the first time a variable is used. That means that the first time you assign to a variable, you have to write something extra there. Say:<br />
     define foo = &#8220;345&#8243;<br />
and the next time you assign foo you just write:<br />
     foo = &#8220;76767&#8243;<br />
But if you now remove the first assignment, then the second one would fail. And if you insert a &#8220;define foo = None&#8221; before the first &#8220;define foo&#8221;, then that would fail. You now have a lot of &#8220;define&#8221; statements you have to move around and get in the correct place. For absolutely no reason.</p>
<p>6. So you want a required formatting that isn&#8217;t required. Hoookay&#8230;</p>
<p>&#8220;I’m not saying I want static typing.&#8221;</p>
<p>Yeah, that&#8217;s in fact exactly what you are saying. But you&#8217;ll get used to dynamic typing soon enough. Most of your complaints are the same reaction that I had when switching to python, and I&#8217;ve seen it happen in several of my friends too, when I&#8217;ve convinced them to try out Python. It goes away.</p>
<p>You call it &#8220;helping you do do your job&#8221;, I call it &#8220;forcing you to go through useless hoops&#8221;. You call it holding the languages hand. Well, I think it&#8217;s the other way around. When I need to constantly tell the language everything. What type everything should be, when a variable is declared for the first time, etc. Why should I tell it these things? It already *knows*! THAT is holding the languages hand.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Annoyances: Followup by Gabriel</title>
		<link>http://blogs.awesomeplay.com/elanthis/archives/2008/08/03/470/#comment-5608</link>
		<dc:creator>Gabriel</dc:creator>
		<pubDate>Sun, 03 Aug 2008 20:14:29 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.awesomeplay.com/elanthis/?p=470#comment-5608</guid>
		<description>You might want to check out Traits (http://pypi.python.org/pypi/Traits/3.0.0) as from what I understand it tries to solve some of what is bothering you. I think PEAK (http://peak.telecommunity.com/) also includes some of the same features. Your gripes still hold, but I think these are libraries that try to address them.

Gabriel</description>
		<content:encoded><![CDATA[<p>You might want to check out Traits (http://pypi.python.org/pypi/Traits/3.0.0) as from what I understand it tries to solve some of what is bothering you. I think PEAK (http://peak.telecommunity.com/) also includes some of the same features. Your gripes still hold, but I think these are libraries that try to address them.</p>
<p>Gabriel</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Annoyances by Sean Middleditch</title>
		<link>http://blogs.awesomeplay.com/elanthis/archives/2008/07/31/468/#comment-5604</link>
		<dc:creator>Sean Middleditch</dc:creator>
		<pubDate>Sat, 02 Aug 2008 15:06:44 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.awesomeplay.com/elanthis/?p=468#comment-5604</guid>
		<description>Hey Lennart,

For (1), I can say without a doubt that Python's documentation is the worst of every major language I've used (and I've used a lot).  Java, C++, Ruby, Perl, and PHP are what I've used the most over the last few years, and the docuementation for all of these is more easily searchable, more explicit, full of more examples, and better presented.

For (2), I don't know what you're getting at.  My complaint is that the Python "file is a module whether you like it or not" is a pain in the ass.

For (3), no, you cannot define instance members.  Try this:

class Foo:
  member = []
  def method(self, value):
    self.member.append(value)

The member variable is a CLASS variable, not an INSTANCE variable.  So, if you create two instances of Foo, and call method("bar") on both, then both instances will see ["bar","bar"] inside of self.member.  You can declare members if they are value types (strings, ints, bools, None), but for anything else you have to define them in the __init__ method.

On (4), I'm not asking that all declarators take the empty ().  I just want consistency.  That could just as easily make it such that a a declarator without any parenthesis behaves identically to one that has an explicit().

For (5), it has nothing to do with being statically typed.  Python DOES force you to define variables!  Try accessing a variable that you haven't defined yet: you get a runtime exception.  What I'd like is a way to make it clear to the reader whether a variable is being declared for the first time or not.  I don't want static typing, that is entirely a different topic than declaring variable names.

And on (6), I never asked that Python error-out if the docstring was poorly formatted.  Java doesn't error out if the javadoc comments are poorly formatted, nor PHP error out if the phpDocumentor comments are poorly formatted, etc.  Mostly I suppose this is a complaint that the pydoc tool that ships with Python is useless (it makes the hard to read, hard to browse, easy to screw up documentation that is seen in the Python standard library).  I've looked around at tools like epydoc and a few others, which show that it's possible to have nice markup in your doc strings and to generate far more readable, complete, and consistent documentation.  I'd be happy if Python 3 just shipped a documentation tool like that -- optional, but it's actually there if you want it without having to grab a ton of third-party code and tools.

So far as the tests argument, yes, weakly typed code DOES need more tests.  There are two things you can test: behavior of implementation and enforcement of interface.  All languages need tests for behavior of implementation.  The difference is pretty key.  For behavior, it is generally pretty easy to test individual modules.  If I have a module that handles some particular data structure, for example, I write tests that use that module's public interface to make sure it does what it's supposed to do.

The problem is when you have a lot of code using a lot of modules.  If you pass the wrong type to a method, it might not be until an entirely different part of the program that that type becomes critical and causes an exception or incorrect behavior.  Writing tests for scenarios like that is a pain, and then tracking down those errors is even more of a pain, and it's a pain that you NEVER have to deal with in a language that actually helps you do your job instead of expecting you to hand-hold the language through everything.

I'm not saying I want static typing.  I just want to ensure that if I define an interface or a class that the language enforce that definition for me.  If I didn't want it defined I wouldn't have bothered taking the time to define it.  PHP is a dynamically, weakly typed language that allows you to (optionally) define the types of function parameters, so ifyou pass in the wrong type you get a run-time error _directly at the point of call_.  That's damn handy.  It also makes the code self-documenting in more cases, making the fancy documentation comments somewhat less necessary (though still useful enough to use for larger modules).

It's unfortunate that people such as yourself see the extreme end of dynamically typed and the extreme end of statically typed as two opposing and incompatible language design methodologies.  That just isn't the case.  It is entirely possible to offer a language with both, such as can be seen with Boo, PHP, some versions of BASIC, ECMAScript 4, and dozens of other languages I'm forgetting.

Some code is just easier and quicker to develop without having to think about typing.  Other code is easier and quicker to develop when you can count on the language backing you up with your interfaces.  Why force programmers to choose one or the other, or force them to code in two completely different and incompatible languages and then waste immense amounts of time bridging them together just in order to get the best of both worlds?</description>
		<content:encoded><![CDATA[<p>Hey Lennart,</p>
<p>For (1), I can say without a doubt that Python&#8217;s documentation is the worst of every major language I&#8217;ve used (and I&#8217;ve used a lot).  Java, C++, Ruby, Perl, and PHP are what I&#8217;ve used the most over the last few years, and the docuementation for all of these is more easily searchable, more explicit, full of more examples, and better presented.</p>
<p>For (2), I don&#8217;t know what you&#8217;re getting at.  My complaint is that the Python &#8220;file is a module whether you like it or not&#8221; is a pain in the ass.</p>
<p>For (3), no, you cannot define instance members.  Try this:</p>
<p>class Foo:<br />
  member = []<br />
  def method(self, value):<br />
    self.member.append(value)</p>
<p>The member variable is a CLASS variable, not an INSTANCE variable.  So, if you create two instances of Foo, and call method(&#8221;bar&#8221;) on both, then both instances will see ["bar","bar"] inside of self.member.  You can declare members if they are value types (strings, ints, bools, None), but for anything else you have to define them in the __init__ method.</p>
<p>On (4), I&#8217;m not asking that all declarators take the empty ().  I just want consistency.  That could just as easily make it such that a a declarator without any parenthesis behaves identically to one that has an explicit().</p>
<p>For (5), it has nothing to do with being statically typed.  Python DOES force you to define variables!  Try accessing a variable that you haven&#8217;t defined yet: you get a runtime exception.  What I&#8217;d like is a way to make it clear to the reader whether a variable is being declared for the first time or not.  I don&#8217;t want static typing, that is entirely a different topic than declaring variable names.</p>
<p>And on (6), I never asked that Python error-out if the docstring was poorly formatted.  Java doesn&#8217;t error out if the javadoc comments are poorly formatted, nor PHP error out if the phpDocumentor comments are poorly formatted, etc.  Mostly I suppose this is a complaint that the pydoc tool that ships with Python is useless (it makes the hard to read, hard to browse, easy to screw up documentation that is seen in the Python standard library).  I&#8217;ve looked around at tools like epydoc and a few others, which show that it&#8217;s possible to have nice markup in your doc strings and to generate far more readable, complete, and consistent documentation.  I&#8217;d be happy if Python 3 just shipped a documentation tool like that &#8212; optional, but it&#8217;s actually there if you want it without having to grab a ton of third-party code and tools.</p>
<p>So far as the tests argument, yes, weakly typed code DOES need more tests.  There are two things you can test: behavior of implementation and enforcement of interface.  All languages need tests for behavior of implementation.  The difference is pretty key.  For behavior, it is generally pretty easy to test individual modules.  If I have a module that handles some particular data structure, for example, I write tests that use that module&#8217;s public interface to make sure it does what it&#8217;s supposed to do.</p>
<p>The problem is when you have a lot of code using a lot of modules.  If you pass the wrong type to a method, it might not be until an entirely different part of the program that that type becomes critical and causes an exception or incorrect behavior.  Writing tests for scenarios like that is a pain, and then tracking down those errors is even more of a pain, and it&#8217;s a pain that you NEVER have to deal with in a language that actually helps you do your job instead of expecting you to hand-hold the language through everything.</p>
<p>I&#8217;m not saying I want static typing.  I just want to ensure that if I define an interface or a class that the language enforce that definition for me.  If I didn&#8217;t want it defined I wouldn&#8217;t have bothered taking the time to define it.  PHP is a dynamically, weakly typed language that allows you to (optionally) define the types of function parameters, so ifyou pass in the wrong type you get a run-time error _directly at the point of call_.  That&#8217;s damn handy.  It also makes the code self-documenting in more cases, making the fancy documentation comments somewhat less necessary (though still useful enough to use for larger modules).</p>
<p>It&#8217;s unfortunate that people such as yourself see the extreme end of dynamically typed and the extreme end of statically typed as two opposing and incompatible language design methodologies.  That just isn&#8217;t the case.  It is entirely possible to offer a language with both, such as can be seen with Boo, PHP, some versions of BASIC, ECMAScript 4, and dozens of other languages I&#8217;m forgetting.</p>
<p>Some code is just easier and quicker to develop without having to think about typing.  Other code is easier and quicker to develop when you can count on the language backing you up with your interfaces.  Why force programmers to choose one or the other, or force them to code in two completely different and incompatible languages and then waste immense amounts of time bridging them together just in order to get the best of both worlds?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Annoyances by James</title>
		<link>http://blogs.awesomeplay.com/elanthis/archives/2008/07/31/468/#comment-5603</link>
		<dc:creator>James</dc:creator>
		<pubDate>Sat, 02 Aug 2008 13:25:32 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.awesomeplay.com/elanthis/?p=468#comment-5603</guid>
		<description>The Python docs were written in a TeX dialect, now (2.6+) they're done with ReStructured Text it seems. &lt;a href="http://epydoc.sourceforge.net/" rel="nofollow"&gt;Epydoc&lt;/a&gt; seems to be less shit than pydoc (which just prints the docstrings raw) and can also use reST.

Does "from app.module.submodule import Class" count as a clever trick?

Lennart: For 3, you missed &lt;blockquote&gt;If a variable is set in a class, that actually defines a class variable, not a member. This works out fine for numbers, booleans, and strings, but not so well for hashes, arrays, objects.&lt;/blockquote&gt; - each Test() should be a new object: &lt;code&gt;class Test:
  a=[1,3,4,5]
&#62;&#62;&#62; Test().a
[1, 3, 4, 5]
&#62;&#62;&#62; Test().a.pop()
5
&#62;&#62;&#62; Test().a
[1, 3, 4]&lt;/code&gt;

Don't &lt;a href="http://www.python.org/dev/peps/pep-3119/" rel="nofollow"&gt;Abstract Base Classes&lt;/a&gt; in Py3K help make classes mean something?</description>
		<content:encoded><![CDATA[<p>The Python docs were written in a TeX dialect, now (2.6+) they&#8217;re done with ReStructured Text it seems. <a href="http://epydoc.sourceforge.net/" rel="nofollow">Epydoc</a> seems to be less shit than pydoc (which just prints the docstrings raw) and can also use reST.</p>
<p>Does &#8220;from app.module.submodule import Class&#8221; count as a clever trick?</p>
<p>Lennart: For 3, you missed<br />
<blockquote>If a variable is set in a class, that actually defines a class variable, not a member. This works out fine for numbers, booleans, and strings, but not so well for hashes, arrays, objects.</p></blockquote>
<p> - each Test() should be a new object: <code>class Test:<br />
  a=[1,3,4,5]<br />
&gt;&gt;&gt; Test().a<br />
[1, 3, 4, 5]<br />
&gt;&gt;&gt; Test().a.pop()<br />
5<br />
&gt;&gt;&gt; Test().a<br />
[1, 3, 4]</code></p>
<p>Don&#8217;t <a href="http://www.python.org/dev/peps/pep-3119/" rel="nofollow">Abstract Base Classes</a> in Py3K help make classes mean something?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Annoyances by Lennart Regebro</title>
		<link>http://blogs.awesomeplay.com/elanthis/archives/2008/07/31/468/#comment-5602</link>
		<dc:creator>Lennart Regebro</dc:creator>
		<pubDate>Sat, 02 Aug 2008 07:58:37 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.awesomeplay.com/elanthis/?p=468#comment-5602</guid>
		<description>1. Docs can always be improved. That Pythons docs sucks is a strange statement, Very rarely do they not tell me exactly what I need. There has been one or two cases where classes have been very briefly documented and not had enough examples, it's true. But that is true about everything in the open source world, where nobody gets payed to document. Python is in that comparison much better than average.

2. Your complaint here are incorrect. Python *is* explicit. What it doesn't do is hide everything by default, instead ot shows everything by default, and that's how Python works. And it's a good thing too.

3. Your complaints here are incorrect. You *can* declare members and default variables in the definition. I don't know how you missed that one, it's trivial. Classes do mean something. Yes, they are "weak". Python is a dynamically typed language. That is also a Good Thing.

4. It's a matter of opinion I guess. Most decorators don't take parameters, so I guess they didn't want to have the empty () in the end for those.

5. Yes, variables aren't declared. Again, Python is dynamically typed. It's a Good Thing. Your grivence on this and point 3 is completely normal when you go from staticly typed to dynamically typed languages. It feels weird in the beginning. However, it's not a problem.

6. True, there is no forced syntax in docstrings. And honestly, would you really want Python to break everytime it encounters a docstring that doesn't have a dot in the correct place? It would just make people stop using them altogether.

All in all, you seem to want Python to force you do things that are not necessary, probably because you are used to be forced by other languages. However, it turns out that this is not necessary. It works fine without it. And the idea that you need more tests because the language is weakly typed is a myth. Weakly typed programming does not need more tests. Python people do not say "you should have tests because the language is weakly typed". We say "you should have tests, and the tets will find these errors too". You need tests anyway. Untested code is broken code. Even in C++.</description>
		<content:encoded><![CDATA[<p>1. Docs can always be improved. That Pythons docs sucks is a strange statement, Very rarely do they not tell me exactly what I need. There has been one or two cases where classes have been very briefly documented and not had enough examples, it&#8217;s true. But that is true about everything in the open source world, where nobody gets payed to document. Python is in that comparison much better than average.</p>
<p>2. Your complaint here are incorrect. Python *is* explicit. What it doesn&#8217;t do is hide everything by default, instead ot shows everything by default, and that&#8217;s how Python works. And it&#8217;s a good thing too.</p>
<p>3. Your complaints here are incorrect. You *can* declare members and default variables in the definition. I don&#8217;t know how you missed that one, it&#8217;s trivial. Classes do mean something. Yes, they are &#8220;weak&#8221;. Python is a dynamically typed language. That is also a Good Thing.</p>
<p>4. It&#8217;s a matter of opinion I guess. Most decorators don&#8217;t take parameters, so I guess they didn&#8217;t want to have the empty () in the end for those.</p>
<p>5. Yes, variables aren&#8217;t declared. Again, Python is dynamically typed. It&#8217;s a Good Thing. Your grivence on this and point 3 is completely normal when you go from staticly typed to dynamically typed languages. It feels weird in the beginning. However, it&#8217;s not a problem.</p>
<p>6. True, there is no forced syntax in docstrings. And honestly, would you really want Python to break everytime it encounters a docstring that doesn&#8217;t have a dot in the correct place? It would just make people stop using them altogether.</p>
<p>All in all, you seem to want Python to force you do things that are not necessary, probably because you are used to be forced by other languages. However, it turns out that this is not necessary. It works fine without it. And the idea that you need more tests because the language is weakly typed is a myth. Weakly typed programming does not need more tests. Python people do not say &#8220;you should have tests because the language is weakly typed&#8221;. We say &#8220;you should have tests, and the tets will find these errors too&#8221;. You need tests anyway. Untested code is broken code. Even in C++.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Annoyances by Richard Tew</title>
		<link>http://blogs.awesomeplay.com/elanthis/archives/2008/07/31/468/#comment-5601</link>
		<dc:creator>Richard Tew</dc:creator>
		<pubDate>Fri, 01 Aug 2008 20:53:17 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.awesomeplay.com/elanthis/?p=468#comment-5601</guid>
		<description>Regarding the "files as modules" problem.  This bothers me as well.

You can add your own namespacing solution over the top of the standard importing system.  So first it looks to your system, then falls back on the standard Python system.

In my &lt;a href="http://code.google.com/p/livecoding/" rel="nofollow"&gt;code reloading&lt;/a&gt; project, I use a module structure based solely on directories.  For instance, given a file "stuff/otherstuff/foo.py", all the contents of 'foo.py' appear in 'stuff.otherstuff'.  The same goes for all the other files in that directory.</description>
		<content:encoded><![CDATA[<p>Regarding the &#8220;files as modules&#8221; problem.  This bothers me as well.</p>
<p>You can add your own namespacing solution over the top of the standard importing system.  So first it looks to your system, then falls back on the standard Python system.</p>
<p>In my <a href="http://code.google.com/p/livecoding/" rel="nofollow">code reloading</a> project, I use a module structure based solely on directories.  For instance, given a file &#8220;stuff/otherstuff/foo.py&#8221;, all the contents of &#8216;foo.py&#8217; appear in &#8217;stuff.otherstuff&#8217;.  The same goes for all the other files in that directory.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Python Annoyances by Kumar McMillan</title>
		<link>http://blogs.awesomeplay.com/elanthis/archives/2008/07/31/468/#comment-5600</link>
		<dc:creator>Kumar McMillan</dc:creator>
		<pubDate>Fri, 01 Aug 2008 19:57:15 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.awesomeplay.com/elanthis/?p=468#comment-5600</guid>
		<description>In addition to what Titus said ( http://ivory.idyll.org/blog/aug-08/reply-to-elanthis ) ...

I'd also add:

- you probably want to make aliases to your submodules.  I.E. if you had defined foobar.utils.settings.reset_all_logs but this function is used so often that you just want to to write:

from foobar import reset_all_logs
reset_all_logs()

then inside foobar/__init__.py you put:

from utils import *

and inside foobar/utils/__init__.py you put:

from settings import *

and inside foobar/utils/settings.py you declare

def reset_all_logs():
    # ...

Once I got used to this idea it made Python's auto namespacing one of its most important features.  In fact, since Ruby is very similar to Python there are only subtle differences.  The Python auto-namespacing, to me, is one thing that makes Python much easier to program in vs. Ruby.  Otherwise, you have to type module "blah" ... end all time.  Ouch!  And trying to read someone's Ruby code to figure out where the objects are defined?  Forget about it.


As for "weak classes" -- I think what you want is :

class Special:
    __slots__ = ['bar', 'foo']

s = Special()
s.barr = 1 # typo &#60;-- raises an error

But, seriously, don't use slots!
http://groups.google.com/group/comp.lang.python/msg/0f2e859b9c002b28

You'll get used to life without them.  Yes, you'll need a good set of tests if you want to be sure that your code doesn't have typos in the variables it is assigning to objects.

I agree about the need for an easier way to declare instance methods.  As for now, I have given in to declaring these in __init__() to the point where it doesn't bother me anymore.

As for decorators, yes they are confusing.  They make your head explode as soon as you try to write one.  But they make a lot of sense when you are using them ;) 

unstructured docstrings.  I agree here too.  And I don't like epydoc so I have not embraced their java-style structured doctests.  Once Sphinx supports some kind of syntax then I will start using it.  FYI: python 3000 will add annotations and I think we will once and for all get access to the meta data you are [rightfully] looking for.</description>
		<content:encoded><![CDATA[<p>In addition to what Titus said ( <a href="http://ivory.idyll.org/blog/aug-08/reply-to-elanthis" rel="nofollow">http://ivory.idyll.org/blog/aug-08/reply-to-elanthis</a> ) &#8230;</p>
<p>I&#8217;d also add:</p>
<p>- you probably want to make aliases to your submodules.  I.E. if you had defined foobar.utils.settings.reset_all_logs but this function is used so often that you just want to to write:</p>
<p>from foobar import reset_all_logs<br />
reset_all_logs()</p>
<p>then inside foobar/__init__.py you put:</p>
<p>from utils import *</p>
<p>and inside foobar/utils/__init__.py you put:</p>
<p>from settings import *</p>
<p>and inside foobar/utils/settings.py you declare</p>
<p>def reset_all_logs():<br />
    # &#8230;</p>
<p>Once I got used to this idea it made Python&#8217;s auto namespacing one of its most important features.  In fact, since Ruby is very similar to Python there are only subtle differences.  The Python auto-namespacing, to me, is one thing that makes Python much easier to program in vs. Ruby.  Otherwise, you have to type module &#8220;blah&#8221; &#8230; end all time.  Ouch!  And trying to read someone&#8217;s Ruby code to figure out where the objects are defined?  Forget about it.</p>
<p>As for &#8220;weak classes&#8221; &#8212; I think what you want is :</p>
<p>class Special:<br />
    __slots__ = ['bar', 'foo']</p>
<p>s = Special()<br />
s.barr = 1 # typo &lt;&#8211; raises an error</p>
<p>But, seriously, don&#8217;t use slots!<br />
<a href="http://groups.google.com/group/comp.lang.python/msg/0f2e859b9c002b28" rel="nofollow">http://groups.google.com/group/comp.lang.python/msg/0f2e859b9c002b28</a></p>
<p>You&#8217;ll get used to life without them.  Yes, you&#8217;ll need a good set of tests if you want to be sure that your code doesn&#8217;t have typos in the variables it is assigning to objects.</p>
<p>I agree about the need for an easier way to declare instance methods.  As for now, I have given in to declaring these in __init__() to the point where it doesn&#8217;t bother me anymore.</p>
<p>As for decorators, yes they are confusing.  They make your head explode as soon as you try to write one.  But they make a lot of sense when you are using them ;) </p>
<p>unstructured docstrings.  I agree here too.  And I don&#8217;t like epydoc so I have not embraced their java-style structured doctests.  Once Sphinx supports some kind of syntax then I will start using it.  FYI: python 3000 will add annotations and I think we will once and for all get access to the meta data you are [rightfully] looking for.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
