Adam Barr talks about what is “knowing” a language on his blog. He argues that knowing a language does not involve knowing the built-in functions (or the standard library.) I must strongly disagree with this view, because if you deal with the lowest level of a language — in this case Python — you don’t write idiomatic code, which means that people who know the language cannot easily understand your code.
Let’s look at a simple Python example, determining the largest element of a list. The person who doesn’t know Python would write:
max = my_list[0]
for my element in my_list[1:]:
if element > max:
max = element
print max
This works (sort of; it would fail for an empty list), but no Python programmer is ever going to use that. The proper way is to use the built-in max() function:
print max(my_list)
There are many other core functions that should be known before one can claim he/she knows Python and a lot of modules too. Don’t try to create your own temporary files, just use the tempfile module! If you try to do it yourself, you expose yourself to a bunch of problems that have already been solved.
Knowing a language is more than just knowing the syntax and the reserved keywords, it’s knowing the core library, the standard library, it’s knowing which features to use and which to avoid. Otherwise, I could claim that I know Java, although my lack of knowledge of the libraries would make me extremely unproductive.
September 7, 2007 at 10:45 am |
I absolutely agree with you. But sometimes you have to comprimise and show that you know about the language by building complex workarounds or algorithms that optimize your custom routine.