Skip to content

Error: super is a reserved word #92

Closed

Description

@hmathers

I tried to call super().__init__ in a child class and got "Error: super is a reserved word"

Activity

  1. BruceSherwood commented on May 12, 2020

    @BruceSherwood
    Member
  2. hmathers commented on May 12, 2020

    @hmathers
    Author
    GlowScript 2.9 VPython
    
    class Ball: pass
    class Orb(Ball):
        def __init__(self): super().__init__()
    ball = Orb()
    
  3. BruceSherwood commented on May 12, 2020

    @BruceSherwood
    Member

    Thanks. I found and fixed a bug in my code, so that if you replace "super()" with "Ball" the program works. As for the use of super(), that does seem to be a RapydScript-NG issue, which I'll report.

  4. BruceSherwood commented on May 13, 2020

    @BruceSherwood
    Member

    Actually, to be compatible with true Python, the statement should be Ball.init(self).

    As for RapydScript-NG, the response to my question was this:

    "super is not supported in RS as it is a keyword in javascript with different semantics. See
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/super"

    So RapydScript-NG isn't going to change. There are limits to how close RapydScript-NG (and therefore GlowScript) can go in turning a Python program into a JavaScript program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions