I’ve been trying for about a year now to think in Python the same way I have been used to think in Perl. I’ve also been trying to push the ball up the hill, and replace ColdFusion at my corner of NLM with Django. Today, I can see the light at the end of the tunnel.
To get the Python Development Environment installed, we had to give the desktop folks a list of machines that are to receive the packages (Node.js 4.1.2, Ruby 2.2, Python 3.5, Java 1.8, ActiveState Perl 5.20) that have been pushed to my desktop. Some days ago, I updated my
Net::LDAP scripts to search for computers rather than users and groups, and then got irritated that they were not in DNS, and so I could not check which computers listed in Active Directory were really there.
Today, I tried again. ActiveState Perl didn’t have
Net::LDAP, and besides, I want to use Python. So, I started in Python on the destkop with
subprocess.Popen. To debug, I used
pdb. The new script came together faster than I would have imagined. It was shorter than the corresponding Perl script. I could have written a script, and it would have taken just as long or longer.
Another project requires me to read all the Semantic Web statements (subject, predicate, object triples) from two files concurrently and compare them as I go. Here I see the purer object model of Python, as I can easily implement all the classes I need in one python script, and use the
if __name__ == '__main__' trick so as to test it thoroughly. I’m using
collections.namedtuple and other tricks to go faster.
So much better, so much more intuitive than Perl. So much cleaner than Ruby. I will never now go back (at least not to Perl).