Search This Blog

Tuesday, March 11, 2008

I am mainly working with C# over the past years, so Python is a language alien to me. But since a lot of people are recommending it over other languages such as Java, partly because of its compactness, and since I want to learn a new programming language or two for my own benefits, so I, huh, started learning it in my free time.

Python is distributed under open source license, which means that you can modify the source code at your will. One of the good points with open source software is that it is a laissez-fair systems with the best always capture the biggest market share. The trouble is that too many choices sometimes confused the uninitiated. One example is there are many different Linux versions floating around and that makes the support for Linux software more expensive. But luckily there is an official Python website, so I just went there and downloaded all the necessary components and software.

After that, I did what a sane programmer would do when confronted by a new language:

Wow, the search showed me lots of materials. So I picked the a link and started working on it. Of course, Hello World is simple, so soon my interest waned.

I decided to try something more challenging. As a target, I made an attempt to contribute to the existing Python open source projects. I downloaded a project and all its source, unzipped it and found that I couldn't make any sense out of it. There were just a lot of sub folders, with a lot of .py extension files in them. I couldn't find out which one was the main one. With the IDLE, downloaded from the official Python website, I simply didn't know how to understand, much less navigate through the jungles of code because there was no solution explorer that aggregated everything together and presented the whole project in a coherent manner.

So I thought I needed a better IDE. After all, the IDLE provided by the official Python website was just too crude for any serious development purpose. Stumbling around, I came across The Eric Python IDE that looked better. So I decided to give it a try.

After the download and installation, I opened the ReadMe file in notepad and it read like this:

Can you understand what was contained inside the file?I thought I could crudely understand the instruction. So I launched my IDLE, open the "install.py", and press F5 to install the IDE. Well, I did this with another scripting language, Matlab and everything inside the scripting files ran. So I expected all the scripts inside the fpython scripting file executed as well.

But this time, I got an error message. It said that the PyQt4 module was not installed.

I needed to find the module and installed it on my own.

Not to be deterred, I installed the PyQt4 module. This time, I needed to run the "configure.py" script file. After running, another error message appearred:

Traceback (most recent call last): File "%Directory%\Open Source\PyQt-win-gpl-4.3.3\PyQt-win-gpl-4.3.3\configure.py", line 30, in import sipconfigImportError: No module named sipconfigI knew it was always not easy to get open source software to work, but I couldn't believe that it was this hard to work with Python the language, maybe working with Python the snake would be easier.

Is working with Python difficult? The Python supporters would say no, of course. They love the language. They say that it is the easiest, the best language to work with.

But that's for Python supporters, the ones who are already familiar with the language.

But for beginners like me, learning Python was a hell of confusing and frustrating experience. I remember when I first started programming, the language used was C, and I used Borland Compiler for that purpose ( Borland Compiler was the dominant compiler in 1990s, before Microsoft took over). I didn't have to search high and low to get the component needed before starting to do programming. And of course, Borland Compiler wasn't free. But I guessed the licence fee did save me a lot of time. Not a bad deal.

My difficulties in learning Python underscored the difficulties in using open source software in general. With the possible exceptions of Mozilla Firefox and NUnit, and some other very general software, open source software generally requires one to tweak the setup or install prerequisites on one's own. The process to get the application or the framework or whatever to work is generally harder for open source software. There is no one-click installation process that will guide you to get everything you ever need. Open source proponents would argue that this gives users the freedom to install the minimum components and the flexibility for customization, but to me this actually hinders new users from getting familiar with the applications.

Not only that, the user documentation is lacking. This is not surprising, as many open source contributors are interested in the hard part of the problem, namely coding and getting the program to work. Who wants to waste their precious time on mundane tasks such as writing on the instructions on how to operate the software? But user documentation is the document the users consult when they run into problems. Without proper documentation, software becomes harder to use.

No wonder the learning curve for open source software is generally steeper than commercial software. Again, don't misunderstand me. There are open source software that have virtually no learning curve at all like NUnit or Firefox. But these are hot applications with perhaps hundreds of thousands users. Giving the user base, it is not suprising to see these applications being fine-tuned to a high degree. But for applications that are not that popular, that have only hundreds of users at most, you will find that they are lacking in the area of usability when compared to their commercial counterparts.

Sorry, don't get me wrong, I love to hear, that someone looks over the edge and tries to learn a new language, but the process of doing this and the conclusions made...I'm not a pythonista defending the language (I'm just interested in it and want to learn it someday), but I had to response something on this.Lack of documentation on open source projects? Trivialization, sorry, definitely not: there are many free tutorials and even complete, easily understandable books about python out there (f.i. Dive into python or Byte of python), freely available.IDLE as the IDE of choice for python? Definitely not... It is meant for a quick checking of certain commands, not for productive development (although it can be done). Searching will give hundreds (well, literally speaking ;-)) of other python IDEs to work with.The screenshot with the messed up readme in notepad: nice to see, using a good editor instead of the basic notepad you can avoid such things.And I must strongly disagree on your conclusions about open source software:- the lack of documentation: you are right if we talk about some little open source projects, but every bigger or popular open source project / os framework I know there is documentation overhead (which is also true for python). The link you provided names the issues for documenting a software, which in my eyes are in great part also true for commercial products. And of course a project with less users will have less documentation, but this doesn't depend on if the software is commercial or not.- Open source is harder to learn: depends heavily on the project, you can't trivialize/generalize it this way.

However my advice if you're still interested in learning python:- Maybe start to learn a new programming language by reading the article in Wikipedia. The provided links at the end of the article are often very useful.- Read either Dive into Python or Byte of Python and try the examples there before trying to add something to an existing OS project where the code will overwhelm you (not knowing the syntax of python, the structure of the project, ...).- If you're coming from the .NET world, maybe beginning with the IronPython-project, which is the .NET-implementation of (the more C-centric) Python, will be simplier as you remain in the CLR-world, but can learn a new language. This way you can also continue to use Visual Studio (search for IronPythonStudio, a VS shell extension), which maybe is your favourite IDE as C#-programmer.

Best regards

David

P.S.: I hate it to post anonymously, but I don't want to share my e-mail with the whole (spammer-)world.

First of all, I am a .Net programmer :-)The difference I find between MS and non-MS programming environments is that the latter continuously holds your hand - things are either hidden behind wizards or wrapped in a framework (eg ASP.NET wraps HTTP, WCF wraps remoting, web services etc).This is good, because it makes me more productive.It is also bad, because it makes me more of a mechanic and less of a programmer.

Once you step outside the cosy, safe MS environment things can be scary :-)No more wizards and wrappers - you've got to dive into things and understand them :-) So hang in there with Python, maybe do one of them "in 24 hours" books for a crash-course, build up some expertise before contributing to an OS project.As for the ERIC readme, the text file was probably created on a Linux box, not a Windows box.So it'll have CR line breaks, not CRLF.Open the file in Wordpad (not notepad) and you should be OK.

I would just like to add, that perhaps you jumped a little too far into the deep-end starting off? I know you want to get busy and get in the middle of it all, but if you went from a simple "hello world" to some intricate and complex library-type thing, I can see how that'd be pretty rough.

I'm drawing on personal experience here- I, too, wanted to learn Python to see what the fuss was about. I still haven't done much with it since the 1 day I played with it, but its still on my todo-list.

Anyways, after the inaugural "hello world", I then made a little script (about 5 lines) that would return a random file out of a given directory each time it was called, then serve it. It took me several hours, but in the end, I was very satisfied with the amount I was able to get done with the very little Python experience I had.

On the other hand, I have what I think is a fairly advanced PHP background, but I can tell you that there are some libraries that confuse the hell out of me (at least until I poke around for several hours), and so, that's why I wouldn't recommend diving so far into the deep end :)

I disagree with people who think this is a Microsoft vs Open Source issue. I also am a newcomer to Python, but a 20 year programmer, and had a great deal of difficulty installing a simple python app. If you compare this with the ease of installing a perl or java OS app, you will see how seriously lacking python is in this department.

Being a MS programmer, like what you said, have its advantages and disadvantages. It is certainly very hard for one to adjust to other worlds once steps outside the MS environment. No wonder MS people are generally resistant towards open source or other languages. MS environment is like an independent ecosystem with little or no interaction with other environments.

I think you need to break out of your Windows mindset and realize that there are more ways to do things than the Micro$oft way. Viewing the ReadMe file in Notepad is an example. This is well know issue with Notepad not reading Unix Newlines. It's obvious by your comment about Linux being more expensive becuase there are more distro's that you are still brainwashed by M$FT. You need to get out more.

interesting to see this.. don't be flushed by other people's comments - learning anything outside of Eclipse/Visual Studio (wysiwyg) is not always easy. I've learned some Python through following the tutorials on django.org, which I can relate to... maybe this will work for you?

A 20 year experienced programmer? Really? You've a constructed your experience in such a way that supports your pre-ordained bias/paranoia about open source software. You use your fumbling with python to make ridiculous generalizations about OS. There is a reason that just about any non-Microsoft developer gets paid more.

Python piqued my interest just this week too, and I went out on the same quest with similar results.

It looks like an interesting language and certainly might be very powerful, but the community around it seems to be horribly disjointed and poorly organized. Going beyond a simple Hello World and hoping to create a Hello World web page, the steps to take were prohibitively obfuscated and confusing.

I haven't given up and intend to give it another shot when I have more time to waste, but I have been severely disappointed thusfar.

PyDev which runs on eclipse and (as suggested by silence, pyscripter) should make you feel very at home developing python on Windows. On the other hand, learning python is also a perfect excuse to get up to speed with Vim, so may be you should try that.

Just want to share that I had the same difficulties when I first started with open source software. When I first started using Linux I was always flummuxed by how hard it was to install anything. Download the source, check the readme for instructions (which were either absent or unhelpful), try to build, fail due to unmet dependencies... go find, download and attempt to install dependencies-- fail because of yet more dependencies, etc...

I finally switched to using Debian and just let apt-get do the work for me to install things. After a year or so of using a Linux system and getting familair with the way things work I can now download and build from source much more easily than I used to but it is still a mixed experience every time.

Same thing with trying to jump into Java with Eclipse, or even getting started with C using the GCC compiler. It takes a lot of research and manual reading on your own before you can understand it enough to know how to use the tools. Its daunting and its also frustrating. Its like they just assume you know everything already and don't bother to walk you through it.

Imagine how hard it was for someone like me, who'd spent most of their youth programming with MS IDEs and tools, to jump into programming C on Linux. Where is my IDE? Where is the drop down menu for "Compile" or "Run"? At least on a Linux system I have /usr/share/doc/* and manpages for every tool I install. Everything you need to know is usually there if you spend time to read it.

I think what interests me the most about the comments is the utter lack of attribution by the ones insulting you for wanting to look beyond Microsoft and Windows to program in. What a shame that they are free enough to comment on your blog with reckless abandon but completely lack any spine in posting with their name attached.

Keep trying. I find that you have to look beyond your comfort zone to get you to more fully appreciate everything else.

I don't condone the harsh statements made here. This impersonal medium is no reason to be rude, people. But having said that, you really do need to learn your tools (ie command line and environment variables) to do anything outside of the MS ide world.

Do you not even understand that notepad can't display files with unix line endings correctly?

No competent programmer would use notepad for anything."

"Sometimes I think people like you should not be allowed to program. Not a surprise that you are a windows user. I mean what the fuck?

python is probably one of the best documented languages out there. The fact that you spent most of the time looking at an ide instead of the language is laughable!

Sorry, I am being harsh. But do yourself a favour and learn a use a programming editor. This ide stuff is useful but not the end all."

"A 20 year experienced programmer? Really? You've a constructed your experience in such a way that supports your pre-ordained bias/paranoia about open source software. You use your fumbling with python to make ridiculous generalizations about OS. There is a reason that just about any non-Microsoft developer gets paid more."

"Retards have no business developing software.

That goes double for you."

What a bunch of arrogant assholes. It's no wonder that interest in software engineering and computer science is on the decline - who wants to work in an industry with a bunch of jerks?

I have a masters degree in electrical engineering and have worked with c, c++, pascal, delphi, java, and even assembler. I'm sure I could hold my own against the jackass posters above, but guess what? I worked in Windows for many years before moving to Linux, and I wasn't aware of relatively trivial things like what the difference between \n and \r\n in text files. I've tried Python, and honestly, I'm not that impressed.

So, soon hui, do yourself a favor and ignore the idiots that post the above crap - someday they will probably be calling you the 'boss'.

As someone currently going through the same exercise as you (learning a new language after years of C#), I recommend you give Python a bit more of a go. IMHO it's a beautiful little language, and has really shown me some great things you can do with a non-C# approach.

Oh, and if you're dead set on staying Microsoft you can always try IronPython (which has a VS.NET based IDE available I think).

Maybe you would be more at home with ruby instead of python since you don't seem to be able to find the documentation for python (or at least don't find it very good). Just keep trying different things, you will find something that you like eventually.

David from post 6 again. The more people you are attracting with your blog entry, the more dumb a** people comment. Ignore them, even they weren't born as hardcore programmers (maybe they haven't even seen one line of code in their lives).As others already said: keep on trying and ignore the destructive comments...David

yea... I don't even like Python, but when undertaking something like learning a new language, you learn what tools work best with it, seek out others experiences, read code snippets, more advanced than Hello World scripts, and be smart enough to understand that some things still run best on a command line??!?. You're ignorance is disturbing, yet I can understand why commercial software costs $400, with people like you developing it.

I guess Python is starting to attract the immature, and abusive over time. I too don't agree with most of the comments in your post, and have seen some great comments that are trying to help you, without being abusive, so I won't add much more except to say that http://www.showmedo.com has a series of beginner videos on Python that might provide a gentle introduction

It looks like you are having more problems trying to run a piece of python software then trying to learn python.

OSS programing languages are far more focused the language then on tools to program in the language. (Microsoft and Sun make money selling you fancy tools to make up for less friendly language design.) The IDE is rarely the killer app for an OSS language.

Instead of playing in the sand a bit you tried to jump into a bulldozer. The IDE you where trying to install used several libraries, it was a project made up of smaller projects. This is a pain in Windows, but if you had been using Linux or Mac for that matter, the dependent libraries would have been downloaded and installed along with the IDE by the package manager.

A good book will help you a lot more then a fancy IDE to learn a programing language. At this point you most likely don't even know what you need from and IDE.

I've been reading some of your posts every once in a while, but this one quite "shocked" me in that it shows so much amateurism (and maybe ignorance) where I had expected a reasonably experienced developer. Things like Notepads problems with non-Windows text files should be known to anyone who has ever worked with a non-Windows FTP server (the like is in use at almost any web hosting provider). IMO the workaround (use Wordpad or some freeware Notepad replacement) should be known to any halfway experienced Windows user as well.And jumping from Hello World to some existing, maybe quite professional project shows some overestimation of oneself. And relying on the "brute-force" approach of just googling for documentation/tutorials, instead of finding these through "semantic" search (ie. looking on python.org where you got the software itself) shows some method of thinking that I personally find weird.

And that you finally interpret your own shortcomings as shortcomings of Python or of Open Source seems a bit unfair to me as well. Your whole post was salted with many blows against Open Source software; but while "the Open Source scene" (hmm... these four simple words comprise a community that is much wider and more diverse than you seem to think) has lots of really relevant problems, I don't think your post really mentioned any of those.

Really, I can understand and myself had many of the problems you described; but I think it's not appropriate to use them as basis for your verdict.

Gee, sorry to hear that story. On Windows, anything that uses PyQt is going to be problematic because Qt isn't free on Windows platform, nor are the most recent versions of PyQt. PyQt is useful for big, honking projects with its 550 classes and 3500 methods but you would be better srved with almost anything else.

Scintilla has a Python Mode, and so does the wonderful favorite of mine, Emacs. Emacs will run checking software and OPython interpreters, and versioning systems inside itself, in fact though it is a text editor and not an IDE. I use emacs for Python, Erlang, C, C++, and other languages which I am ashamed to admit I know.

Tell you what. Spend a few Euro on Mandriva Flash from http://store.mandriva.com and boot your winbox from it. You will have a nice development environment and it is all polished and it leaves no traces on your hard disk that you were running linux. The 8G flash has 4G free for projects, even after you use their update facility to download KDevelop (which uses QT, btw) and maybe DrPython and a few other IDEs to try out. None will require tweaking.

My self, I down load Python 2.5for Windows and was up and runningin no time. I installed it on a memory stick and can use it any where a computer has a USB socket. I was luck to find a great book onlearning it. I had no problempicking Python 2.5. Granted, I have learn many different computer languages before this one.

I almost feel sorry for IT people who have never been exposed or have had little or no experience with Free/Open Source operating systems , programming languages, applications etc. To me I really cant understand why someone who was genuinely interested in learning or working with anything having to do with computers would want to stay in a MS world and not jump ship immediately over to a Linux/BSD open environment. Yes initially it may seem overwhelming but the advantages are just plain tremendous.

I almost feel sorry for IT people who have never been exposed or have had little or no experience with Free/Open Source operating systems , programming languages, applications etc. To me I really cant understand why someone who was genuinely interested in learning or working with anything having to do with computers would want to stay in a MS world and not jump ship immediately over to a Linux/BSD open environment. Yes initially it may seem overwhelming but the advantages are just plain tremendous.