[Python-Dev] Grammar change in classdef
talin at acm.org
Sun Sep 17 00:12:25 CEST 2006
Lawrence Oluyede wrote:
>> That was my first thought as well. Unfortunately a quick test shows
>> that class Foo(): creates an old style class instead :(
> I think that's because until it'll be safe to break things we will
> stick with classic by default...
But in this case nothing will be broken, since the () syntax was
formerly not allowed, so it won't appear in any existing code. So it
would have been a good opportunity to shift over to increased usage
new-style classes without breaking anything.
Thus, 'class Foo:' would create a classic class, but 'class Foo():'
would create a new-style class.
However, once it's released as 2.5 that will no longer be the case, as
people might start to use () to indicate a classic class. Oh well.
More information about the Python-Dev