[Python-Dev] Grammar change in classdef

Brett Cannon brett at python.org
Sun Sep 17 02:45:57 CEST 2006


On 9/16/06, Talin <talin at acm.org> wrote:
>
> 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.


We didn't want there to suddenly be a way to make a new-style class that
didn't explicitly subclass 'object'.

-Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060916/f30361fe/attachment.htm 


More information about the Python-Dev mailing list