Category Archives: Python

Database types in OCaml and Python

Consider the following Oracle table: Note that both the values inserted were identical. In Python: Same results in SQL and Python. But in OCaml: What happened there? Well, OCaml is seeing the first column as “1.” and the second as … Continue reading

Posted in Ocaml, Oracle, Python | Leave a comment

Dictionary format strings

There is quite a nice feature of Python that allows dictionaries to be applied to format strings, rather than just relying on the position of each conversion specification. To give a trivial example: Becomes: I use this technique all the … Continue reading

Posted in Ocaml, Python | 15 Comments

The List Monad in Python terms

Understanding Monads Via Python List Comprehensions

Posted in Haskell, Python | Leave a comment

The State Monad in Python terms

Consider a function like sin. It is a “pure” function, which is to say that it is referentially transparent – every time you call sin(pi) it will return the same value. You could in fact in C say #define sin(pi) … Continue reading

Posted in Haskell, Python | 5 Comments

Comparing Python and Ocaml

I wrote some Python code a while ago for neatly formatting tabular output, for generating reports on the command line or from cron jobs to email. Typically this would be populated with a result set from a query “joined” with … Continue reading

Posted in Ocaml, Python | 11 Comments

Hello world!

I am (mainly) a DBA, tho’ I also dabble in other bits of back-end infrastructure (operating systems, storage and so on), and one of my key metrics is the ratio of DBAs:DBs in an organization. To that end I am … Continue reading

Posted in Haskell, Ocaml, Python | 4 Comments