Getting ready for the Python breakage

By Angus Kidman, ZDNet.com.au
01 February 2008 12:26 PM
Tags: python, linux.conf.au, google, code

If Google starts behaving oddly later this year, it might not be due to too many YouTube videos of Britney Spears losing it or a stealth attack by Microsoft's minions, but because of a forthcoming change to the Python programming language.

The launch of version 3.0 of Python, expected within the next year, will see major changes to some fundamental elements of Python, release manager Anthony Baxter explained in a keynote speech at linux.conf.au in Melbourne.

Python is used extensively by Google for many of its products, including the popular YouTube video sharing site.

"3.0 is also known as the release where we break all your code but we're doing it for a good reason," Baxter said. "Python is 16 years old. Like all 16 year olds, it's got some really annoying features."

Want to know more?

For all the latest news, analysis and opinion on open source, click here

"Pretty much every program will need changes," Baxter said, but he stressed that the shift would be some time in coming. "2.x is also not going away. There is going to be a 2.6, it'll be out at about the same time as 3.0. We're not expecting everyone to turn around and rewrite their massive code bases the day after 3.0 comes out -- that would be very foolish. We'll keep maintaining [the 2.x series] as long as there is interest and need."

Both the 2.6 and 3.0 releases are due to appear in late 2008 or early 2009. "I really do think it'll be early next year before it's out. I think there's so much work to bed it down," Baxter said.

When they do come, those alterations will present a big challenge to a company like Google, where Baxter has his day job. Around 15 percent of the search giant's total code base is written in Python. "We get a lot of coders. Obviously I can't say how many, but it's a lot," Baxter noted.

The increasingly complexity of the language has made it difficult for Google's developer teams to work with multiple languages. "[Python] is used for a lot of the core glue. People are having to bounce between Java and Python. They need to context switch. In that case, a lighter-weight language is a huge bonus. For these guys, simpler is much, much better."

One of the most notable changes is turning the "print" statement, used for all kinds of information output, into a function. "Currently print has awful syntax for doing all sorts of things," Baxter said.

"The other one that's going to break a lot of code really subtly is that Unicode is now the default. There's a real shambles in Python at the moment when it comes to mixing Unicode and non-Unicode strings."

Other alterations, such as altering models used for division and switching the symbols for "not equal" from "<>" to "!=", have long been discussed in the Python community but have been held back because of fears over backward compatibility. With the shift to 3.0, the view is "what the hell, we're breaking the code anyway, let's fix it", Baxter said.

"It's a good thing, backward compatibility, but you have a cost. There's always a cost when you make a decision to keep around the old rubbish. It hurts.

"To minimise problems with changes, Python 2.6 is also being altered to warn developers of constructs which might prove troublesome when they shift to 3.0. "In 2.6 we've added a bunch of warnings, and there's going to be more of these going through," Baxter said.

Advertisement

Talkback 3 comments

    What's with the header to this article? Anonymous -- 02/02/08

    That's a pretty sleazy lede guys. Look --

    - YouTube won't break. Nobody is telling Google to 'you will assimilate', Py 2.5.x will be on the support path for quite a while. so they can stay there quite a while while the code is recalibrated.

    - It has been a known fact by the Py community that there would be a clean break with 3.0. No surprises there.

    Scares are not needed.

    OMG, Python's Going to Destroy Google! Anonymous -- 05/02/08

    ...not. Good grief.

    If anything, Google is in a better position than most to handle the changes in Python, given that Python's lead programmer, Guido van Rossum, is a Google employee.

    Python's an excellent programming language, one of the cleanest and most productive language designs in the industry, and this change will make it nicer still. Not a huge story, not an excuse for panicky speculation, just a good tool getting better.

    The absolute stupidity of PYTHON Anonymous -- 06/12/08

    How can these brilliant programmers be so incredibly DAFT and STUPID, deciding for no massively compelling reason, to switch up on print, changing it to print(), thereby breaking just about ALL previous Python programs and Python tutorials in existence. Part of the appeal of Python was that it DID NOT LOOK LIKE C, which is puke. By changing

Add your opinion

Latest Videos

Blogs

  • Darren Greenwood Telecom NZ savings damage prospects
    If Telecom NZ wants to have any of the NZ$1.5 billion the government intends to spend on its new broadband network, it had better think long and hard before offshoring 1500 jobs.
  • Array iiNet: The whys and what nows
    Last week the Federal Court ruled that internet service providers are not responsible for copyright violation by their customers. This is an important decision not just for iiNet, which spent around $4 million defending the case, but for all ISPs in Australia and, indeed, globally.
  • Array Govt, hurry up with releasing data
    A programmer scraped data from the My School website to make some really cool heat maps showing regions of smart schools — no thanks to the government, which didn't supply the data in any useful kind of format.
  • More blogs »

Tags

Back to top

Featured