Interesting article at O’Reilly “Understanding Newlines” which is written for Perl but holds true for Python, too. I knew about possible problems but did not run into any problems with newlines yet. But the actual details I did not know completely and so understand why Subversion complains about a mix of newline characters in files I have checked in (which probably was coworkers and me use different editors with even different option settings). Now I also understand what textmode opening of files actually does. This may seem ignorant but until now I almost always worked with textfiles anyway which do not cause problems when using the default textmode filemode of Python and other languages…
Anyway, interesting article, also because some infos about unicode newline characters.
I just activated the Akismet Plugin for WordPress as I’d like to reactivate comments on this blog. Let’s see it that works…
UPDATE: Seems to work, only 1 link per comment allowed though
While reading the new edition of David Beazleys Python Essential Reference (covering Python upto 2.4) I started thinking about programming language libraries.
Python’s standard lib is small enough to know almost completely, at least you may read up on the ones you are interested in and skip the rest but at least know what is there.
On the other hand Java’s standard library is quite a bit bigger and I am not sure if it actually covers even the same broad appliance possibilities.
(On a side note I remember having read that PHP has > 1000 builtin functions, Perl > 200 and Python only about 60).
I guess comparing all libraries which are available for Python and Java the relation is maybe the same or even worse. And at the same time for Python I never had a problem finding a library for any problem which I needed one for – this not being representative of course
I know there are tons more Java programmers out there and therefor much more libs too…
But all in all I still think Pythons stdlib is just right (ignoring deprecated libs present only for backwards compatibility reasons). In reading the new editition of the Essential Reference I found quite a few things I did not know or simply forgot (like the reversed() buildin), especially new (Python-) developments like decorators etc.
Simply the possibility to read about almost the complete stdlib in a few hours is what makes this nice. I guess I even buy the new edition of Python in a Nutshell by Alex Martelli just to cover another few blank spots in my knowledge (Python 2.5 .
Another question to self though, is it possible or does it even make sense to know a language “perfectly” or just even “very good”? I think yes just to prevent reinventing wheels etc but on the other hand the sheer amount of languages and stuff to know makes you think if a deep knowledge is actually a thing to strive for. I guess the old specialist versus generalist thing, ideally I’d like to be both. I guess I consider general-things-only a bit shallow and specialist-stuff-only not general enough which sometimes results in loss of the bigger picture which I experienced (or better observed) quite a few times in the past. At least currently a solution is to know a lot of stuff a bit and a few things very good…
I try to avoid Java programming as it normally is not really fun. But I had to do an adjustment to a JSP in which a XML was loaded as a file and parsed with basic DOM (no libraries available so just plain DOM . The change was merely to load the XML from a URL instead. But I never did that before so I thought before trying this in the JSP itself I rather try it out with Jython first. I had installed Jython 2.2a1 as my new Laptop at work has JDK 1.5 installed (which seem to work better with 2.2 instead of 2.1). So i simple started the jythonconsole script (a bit scruffy but perfect for this simple task as it has auto-completion) and hacked away without even looking at the Java API docs. I know myself around the libs a bit so it took nothing more than about 5 minutes and the thing worked. Translating the stuff back to the JSP took a bit longer as all the declaration and exception catching stuff does get tedious. But all in all I reckon this was much easier and also quicker than working in the JSP itself.
I sometimes wonder why not more people at work use Jython. Most are full time Java programmers but I noticed even they tend to take quite some time with exploration of new (or simply unknown) features or libraries. This is very easy with Jython and also really fun too. But maybe a full time java programmer does not know how to have fun (ok, sorry