Sunday, August 30, 2009

My Personal take Python 31 on Windows

Downloaded and installed Python 3.1 on Windows to kick around the tyres a bit on the new version of Python. Currently I am getting myself used to one of the biggest changes where print is now a function. This means that stuff like this:

print "testing"

will not work anymore. This will now give you an error :


>>> print "testing"
File "", line 1
print "testing"
^
SyntaxError: invalid syntax


The help function has also been made a function. This means that ....

help will not work too and will just end up ...



>>> help print()
File "", line 1
help print()


Now you will have to put up the parentheses like so ... help(print)

The map function will also not work like it used to. I am still trying to find out how it works.



>>> def print_me(line):
... print (line)
...
>>> print_me("stuff")
stuff
>>> a = ["print","me","now"]
>>> map(print_me,a)
map object at 0x01765CD0



These means too most of my code would be borked .. sigh! Stuff that I have been using for my client's code like Django and Zope will need to be updated too. This is all I have explored for now. Will write more as I encounter more.

Update: I updated the title a bit after the first comment. Tsk tsk some people can so be so uptight these days.