[Python-ideas] Definition Symmetry (original) (raw)

Chris Angelico rosuav at gmail.com
Thu Jan 31 22:43:51 CET 2013


On Fri, Feb 1, 2013 at 5:11 AM, Ned Batchelder <ned at nedbatchelder.com> wrote:

I think parens for super class are an unfortunate syntax, since it looks just like arguments to the class and is confusing for some beginners:

def function(arg): ... function(10) # Similar syntax: 10 corresponds to arg class Thing(Something): ... thing = Thing(10) # How does 10 relate to Something? It doesn't. A better syntax (which I AM NOT PROPOSING) would be: class Thing from Something:

What about

class Thing = Something: pass

I am not proposing this either, but it would emphasize the difference between superclasses and init args.

But really, parens are used in many different ways. There doesn't need to be a logical parallel between generator expressions and function calls, for instance.

ChrisA



More information about the Python-ideas mailing list