Browse files

tweaked readme

  • Loading branch information...
1 parent ea965db commit cdbb413c6cf4df9a6ae39b96bc9db0efb48f1443 @lihaoyi committed May 8, 2013
Showing with 4 additions and 6 deletions.
  1. +0 −5 macropy/macros2/
  2. +4 −1
5 macropy/macros2/
@@ -7,12 +7,8 @@
for line in open("macros2/linq_test_dataset.sql").read().split(";"):
db = generate_schema(engine)
def compare_queries(query1, query2):
res1 = engine.execute(query1).fetchall()
res2 = engine.execute(query2).fetchall()
@@ -27,7 +23,6 @@ def compare_queries(query1, query2):
print res2
raise e
class Tests(unittest.TestCase):
Most examples taken from
@@ -338,9 +338,10 @@ print Point(1, 2) == Point(1, 2)
[Case classes]( are classes with extra goodies:
-- A nice `__str__` method is autogenerated
+- Nice `__str__` and `__repr__` methods autogenerated
- An autogenerated constructor
- Structural equality by default
+- A Copy-constructor, for creating modified copies of instances
The reasoning being that although you may sometimes want complex, custom-built classes with custom features and fancy inheritance, very (very!) often you want a simple class with a constructor, pretty `__str__` and `__repr__` methods, and structural equality which doesn't inherit from anything. Case classes provide you just that, with an extremely concise declaration:
@@ -434,6 +435,8 @@ This is an implementation of a singly linked [cons list](
As the classes `Nil` are `Cons` are nested within `List`, both of them get transformed into top-level classes which inherit from it. This nesting can go arbitrarily deep.
+Overall, case classes are similar to Python's [`namedtuple`](, but on steroids (methods, inheritence, etc.), and provides the programmer with a much better experience.
Pattern Matching
Pattern matching is taken from many functional languages, including Haskell,

0 comments on commit cdbb413

Please sign in to comment.