Friday, December 01, 2006

Lost memories : Tech Talk by Guido in Google

Some time back there was a tech talk in Google given by Guido about Python 3000. I blogged live from the talk, but never came around to publishing it publically. So, here's it, copying as it is.
"Hi, I'm Guido. Creator of Python Programming Language. I joined Google last december, and its great working here."

Idea behind Python 3000:
- Dun design a new language.
- Lot of bug fixes, even old ones from 90~91.
- Dun become Perl 6

- backward compatibility
- migration of code from 2.x to 3.x

- Certain python features from 3.x will be provided to 2.x as well
- Development of 2.x and 3.x will go parallel
- 2.6 - certainly, 2.7 likely, beyond 2.9 never!

- All string unicode by default
- dict.keys(), range(), and zip() won't return List
- keys() shd have iterator
- Drop <> as alias for !=
- Redesign I/O library. Currently based upon C I/O library. Core dump in C is fine, but not in Python. Need to know how many bytes are already buffered, while doing I/O (?).

NOT going to DO:
- change hash, keys to attributes - dict.keys() to dict.keys
- have programmable syntax / macros
- change look and feel of language
- add radical new features (can always do it later!)

- Use pychecker to do an 80-90% job - but can't do it with certainity.
- warns about doomed code - like dict.keys().sort() (Note, dict.keys() is no longer a List. Its an iterator. Do I agree with Guido on this? Probably not!).

Some operations:
- In 2.x -> x//y will return float, not x/y!
- In 3.x -> If x and y are Integers: x/y will return float.
- Say "if key in dict" rather than dict.has_key()

- Kill classic classes. Classic classes will no longer exist in 3000
- Exceptions must derive from BaseException
- Remove last differences b/w int and long
- Scenario: Suppose you have a sub module named sys, whenever, you say "import sys", it will utilize the sub module, rather than the python library.
3.x - When you say "import sys", it will always get python library. To utilize your sub module named sys, you need to say "import .sys"
- Kill ancient library modules

Minor changes:
- exec becomes function again
- [f(x) for x in S] is a syntactic sugar for list(f(x) for x in S)
- kill raise E,arg in favor of raise E(arg)
- print no longer a statement!
- print x,y,z becomes print(x,y,z)
- print >> f, x, y, z becomes print(x,y,z, file=f)
- alternative to skip the space/newline:
- print (format, x, y, z)?
Why not f.print(x,y,z):
- some file types dun have print method. they have write method.

- x == y. If x is completely diff type than y, return false
- x < y. has a random decision based upon location in memory, but its problamatic in jython, where objects can move in memory.
- Raise TypeError exception

Check PEP245/246 - take an object to the type, so that the return object is either the same type, or at least behaves as that type.

- Read PEP 3100 for a much larger laundry list.
- follow the list:
- range() no longer returns list, use xrange
- bytes and str instead of str and unicode
- bytes have some str-ish methods like b1.find(b2), but not others like b1.upper()

I/O Stack:
- C stdio has problems:
- dunno how many bytes are in the buffer

Lambda lives!
- Last year Guido wanted lambda to die!
- lambda has hard core following of people, who tried convincing.
- We still dun have a better version, even after an year of trying!
- lambda lives!

Quotations by Guido (including random jokes):
- "I had no life, so I created Python!"
- "To start developing a great software, you'd be having no life outside!" (i lost the essence! :()
- "I'm going to believe my gut feeling on this, and its getting bigger!"

Python Sprint @ Google
Aug 21 - 24. Where: NY, and MV
What: Hack Python 2.6 and Python 3000, 2.5 bug fixing

Update: Ola pointed out that the video is available on Google Video.


Ola said...

The video is online at Google Video.

Mehdi Karimzadeh said...

Dear Friend,
merry Christmas and Happy NEW YEAR.
I visited your weblog. It was good and it had some useful information and ...
Please come to my New Weblog for download Mobile's Softwares, Games and codes.(if interested add it as your link)

Thank you so much