Should I learn Python instead?

Serge Orlov Serge.Orlov at gmail.com
Fri Apr 14 19:11:24 EDT 2006


fyleow wrote:
> Hi guys,
>
> I'm a student/hobbyist programmer interested in creating a web project.
>  It's nothing too complicated, I would like to get data from an RSS
> feed and store that into a database.  I want my website to get the
> information from the database and display parts of it depending on the
> criteria I set.
>
> I just finished an OO programming class in Java and I thought it would
> be a good idea to do this in C# since ASP.NET makes web applications
> easier than using Java (that's what I've heard anyway).  I thought it
> would be easy to pick up since the language syntax is very similar but
> I'm getting overwhelmed by the massive class library.  MSDN docs are
> very good and thorough but the language just seems a little unwieldy
> and too verbose.
>
> This is how to access an RSS feed and create an XML document to
> manipulate it.
>
> System.Net.WebRequest myRequest = System.Net.WebRequest.Create("//feed
> url here");
>         System.Net.WebResponse myResponse = myRequest.GetResponse();
>         System.IO.Stream rssStream = myResponse.GetResponseStream();
>         System.Xml.XmlDocument rssDoc = new System.Xml.XmlDocument();
>
>         rssDoc.Load(rssStream);
>
> Here's PHP.
>
> $rss_feed = file_get_contents($rss_url);
>

Here is Python (including printing all titles in the feed):

import urllib
import elementtree.ElementTree as ET

feed = ET.parse(urllib.urlopen("http://www.python.org/channews.rdf"))
for item_title in feed.findall("channel/item/title"):
    print item_title.text

elementtree library is available here:
  http://effbot.org/zone/element-index.htm

> I realize that learning the library is part of the process, but as a
> beginner I appreciate simplicity.  Is Python easier than C#?

Developers of Python try to make it simple and powerful, so in general
Python is easier to use, but you may hit corner cases.


> Any other advice for a newbie?

Sometimes open source documentation is harder to understand than
documentation for commercial libraries. In such cases I usually walk
over all functions in the library trying them, getting familiar with
the library's jargon. So the learning curve is more steep but when
you're on the top things are much easier.

  Serge




More information about the Python-list mailing list