Thursday, April 10, 2008

Learning Python

Thanks to the Google Apps account, I'm now learning Python (to some extent). The first important task when learning a new language is learning to read errors. After a few, I think I know what the interpreter is trying to tell me when it's not happy. But the first time is always the funnest.

As a complete Python newbie, I initially missed the difference between:

class MainPage(webapp.RequestHandler):
def get(self):
self
.response.headers['Content-Type'] = 'text/plain'
self
.response.out.write('Hello, webapp World!')

def main():
application
= webapp.WSGIApplication(
[('/', MainPage)],
debug
=True)
wsgiref
.handlers.CGIHandler().run(application)
and
class MainPage(webapp.RequestHandler):
def get(self):
self
.response.headers['Content-Type'] = 'text/plain'
self
.response.out.write('Hello, webapp World!')

def main():
application
= webapp.WSGIApplication(
[('/', MainPage)],
debug
=True)
wsgiref
.handlers.CGIHandler().run(application)

10 minutes into the lexical spec and not only did I get the error here, I got a far better and first hand understand of Python. Now the task is to keep learning...

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home