A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-February/051691.html below:

[Python-Dev] Requesting that a class be a new-style class

[Python-Dev] Requesting that a class be a new-style class [Python-Dev] Requesting that a class be a new-style classNick Coghlan ncoghlan at iinet.net.au
Sat Feb 19 06:03:27 CET 2005
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.

Which leads in to the real question: Does this *really* need to be a syntax 
error? Or could it be used as an easier way to spell "class C(object):"?

Then, in Python 3K, simply drop support for omitting the parentheses from class 
definitions - require inheriting from ClassicClass instead. This would also have 
the benefit that the elimination of defaulting to classic classes would cause a 
syntax error rather than subtle changes in behaviour.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4