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)

5 comments:

  1. Hi! I am C++ and Matlab programmer. Would you recommend me to switch to Python? I have heard lots good references about this language. Is this a nice programming language for a webdesign? Thanks in advance.

    ReplyDelete
  2. Hi Christopher!
    Actually it depends on your purposes. Anyway if to choose between C++ and Python for web development (actually not only), I'd choose Python of course, although I'm Python newbie. You can look for Django framework, I heard good things about it but I have never tried it.
    Hope it helps at least a little bit)

    ReplyDelete
  3. Hello!
    At the moment I would like, just for the sake of broadening my mind, get basic knowledge of the Python language. I have some experience in programming Pascal and C++ applications (studied them at school, once even won a local contest). Now I'm afraid I will have to consult my manuals if I need to write some program, but to me it's not a problem to recall familiar material in a short period of time. That said, what would you recommend me for starting and picking up the basics? I need both programming environment for Vista and an _understandable_ manual. Hope after mastering the language at a basic level I'll manage to advance on my own.
    Thanks,
    One of your ukwiki colleagues.

    ReplyDelete
  4. Hi!
    Official tutorial is really good one. You can find it here: http://docs.python.org/tutorial/index.html. Python distribution goes with basic IDE called IDLE which could be suitable for learning purposes. There is really great Python IDE from JetBrains - PyCharm (http://www.jetbrains.com/pycharm/) It has only one but serious problem - it is commercial product:) However you can try 30-day free trial.
    Good luck in your studies!

    ReplyDelete
  5. Well, the Python 2.7.1 I have downloaded just now seems to go with the same tutorial and doesn't look like its use is limited. The only problem is that I still have no idea at all how it works=). Could you at least tell me what to begin with? How to launch the application - is there a special file, like in Pascal, or something must be inserted manually to the command line? Thanks.
    P.S. Can I ask you also to give an example of a primitive program source code? For my way of thinking, it can be very helpful.

    ReplyDelete