Sunday, January 9, 2011

Learning of Python: Pywikipedia and Facebook Hacker Cup

Being a student of computer science related department in Ukraine usually means that you have been familiarized with a bunch of programming languages. Of course generally it means that you don't know any of them unless you'll learn some on yours own:) As for me I could say that I'm really familiar more or less with only most popular languages. So it occurred to me that learning something totally new language will do me good. I think that could help you to expand your horizon that is always good idea in my opinion.

So that "something totally new" for me was Python) Actually I got involved in Python because of use of Pywikipedia framework (I don't think that cheating by editing of save files for Blade of Darkness should be counted:)). This is quite good framework for doing some useful automatic edits to Wikipedia with bot account. Of course running of scripts doesn't require knowledge of Python itself, but the time of learning comes when standard features are not enough or you want to tune standard scripts for yourself. First tries were like "copy these lines from here and that lines from there". Oh, you know, you can work at least on junior position at some software companies with such "coding" skills:) But the appetite comes in eating, so I decided to read tutorial to learn something new and systematize that I knew already.

I must say that sometimes I was impressed with Python features and how easily some things can be done with them. Of course you know problem about swapping two variables without explicit use of other variables. Can it be done more simple than in Python?) Just look:
a, b = b, a
Do you want the list of squares? Short and simple:
squares = [t*t for t in xrange(0, maxN)]
Of course these examples don't show all power of Python, this is just the first things that came to my mind. For more cool examples look, for example, into this StackOverflow question: Hidden features of Python

And additional note about official documentation. It is really good for Python newcomers and explain things with lot of examples and good explanations. Recommend! (ha-ha, looks like as feedback on Ebay:))

As conclusion I want to say that if you never programmed in other languages than classic imperative compilable (Java, .NET languages etc), then you just must to try something really different. At least for comparison. And who knows, maybe you won't return back;)

P.S. And probably you'll ask what is about Facebook Hacker Cup that is mentioned in title? Simple - this is first contest that I'm trying to compete in with Python:) I think that I'll write separate post about it. And Pywikipedia too)