optional parens in top-level class declaration

Jim Althoff jima at aspectdv.com
Tue May 30 15:00:13 EDT 2000


(Apologies if this topic has been covered before.)

Has there been any consideration given to allowing
empty parens in a top-level class declaration?

e.g.,

class Foo(): pass

as an alternative to

class Foo: pass

Although it is not a big deal, I think it would be
somewhat more convenient when testing out
a new class and changing your mind about
the superclass structure to be able to add or
delete from within the parens without having
to go to the extra step of adding and removing
the parens themselves when including or eliminating
superclasses.

And it would be more consistent with function
defs which include the empty parens when zero
args are specified.

I realize this would need to be optional for
compatibility reasons.

Would this introduce any parsing problems?
Any other potential disdavantages?

Jim





More information about the Python-list mailing list