Skip to content

Removing g from the list of py5 "reserved words" breaks things #317

@hx2A

Description

@hx2A

I can define a variable named g but I can't actually use it. Simple example:

g = 42
x = g + 10

result:

py5 encountered an error in your code:


    1    g = 42
--> 2    x = g + 10
    3    
    ..................................................
     g = 42
    ..................................................

TypeError: 'int' object is not callable

I don't know why I didn't find this problem before. I guess when I tested it I only tested I could create a variable named g but didn't use it for anything.

I agree with @villares 's logic of allowing g as a variable name because single character reserved words are problematic. However, this configuration isn't going to work.

The solution is to rename g to something else, such as graphics. The new name will become a reserved word. @villares, are you ok with renaming g to graphics and making it a reserved word? Any other name suggestions?

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