I am not writing this to jump all over Big Jim's post but after reading it and seeing the syntax of Scala (and Java), I can't help but wonder, why anyone would use either language (based on syntax). Yes I know it is a matter of taste and everyone has an opinion. Let's just say my taste lean toward more succinct code.
#!/usr/bin/python
#
# Set up initial work
#
import psycopg2
conn = psycopg2.connect("dbname='postgres' user='postgres'")
cur = conn.cursor()
cur.execute("SELECT * FROM pg_database")
def output(cur):
#Run two queries, one for headers, one for data
tuples = cur.fetchall()
colname = [x[0] for x in cur.description]
buff = "\t" + "\t".join(colname[0:4]) + "\n"
for row in tuples:
# This is a little one liner but could easily be expanded
# for readability
buff += "\t" + "\t".join([str(i) for i in row[0:4]]) + "\n"
return buff
print output(cur)
I keep looking back at Java merged/derived/munged/glued languages, Groovy looks interesting and of course there is Jython but I think I will stick with good old fashion CPython just as I am sure that MST will stick with Perl.