On Sun, Feb 20, 2005 at 12:13:25PM +1000, Nick Coghlan wrote: > Guido van Rossum wrote: > >>>This is something I've typed way too many times: > >>> > >>>Py> class C(): > >>> File "<stdin>", line 1 > >>> class C(): > >>> ^ > >>>SyntaxError: invalid syntax > >>> > >>>It's the asymmetry with functions that gets to me - defining a > >>>function with no arguments still requires parentheses in the > >>>definition statement, but defining a class with no bases requires the > >>>parentheses to be omitted. > > > > > >It's fine to fix this in 2.5. I guess I can add this to my list of > >early oopsies -- although to the very bottom. :-) > > > >It's *not* fine to make C() mean C(object). (We already have enough > >other ways to declaring new-style classes.) > > > > Fair enough - the magnitude of the semantic difference between "class C:" > and "class C():" bothered me a little, too. I'll just have to remember that > I can put "__metaclass__ == type" at the top of modules :)
I always use new style classes so I only have to remember one set of behaviors. "__metaclass__ = type" is warty, it has the "action at a distance" problem that decorators solve for functions. I didn't dig into the C but does having 'type' as metaclass guarantee the same behavior as inheriting 'object' or does object provide something type doesn't? *wince* Py3k? Faster please[*]. -Jack * a US-ism of a conservative bent, loosely translated as "change for the better? I'll get behind that." _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com