Python syntax in Lisp and Scheme

Alex Martelli aleaxit at yahoo.com
Sun Oct 12 16:17:01 EDT 2003


Pascal Costanza wrote:
   ...
>> Where in that example are you aware that you are dealing with classes
>> and objects?
> 
> Well, maybe I am wrong. However, in a recent example, a unit test
> expressed in Python apparently needed to say something like
> "self.assertEqual ...". Who is this "self", and what does it have to do
> with testing? ;)

Here self is 'the current test case' (instance of a class specializing
TestCase), and what it has to do with the organization of unit-testing
as depicted in Kent Beck's framework (originally for Smalltalk, adapted
into a lot of different languages as it, and test-driven design, became
deservedly popular) is "just about everything".  I think you might like
reading Kent's book on TDD -- and to entice you, you'll even find him
criticizing the fact that 'self' is explicit in Python (it's kept implicit 
in Smalltalk).  If you don't like O-O architecture, you doubtlessly won't
like Ken's framework -- he IS a Smalltalk-thinking OO-centered guy.


Alex





More information about the Python-list mailing list