Skip to content

Syntax update #17

@AMDphreak

Description

@AMDphreak

After the import statement, the assignment line is the only time you refer to the library directly. I think most people would want to skip the object declaration and put that in the import statement. To streamline your app with this way of operating and conventional way of choosing variable names, I recommend using the variable name settings and renaming your functions to load() save() etc, instead of s.load_settings() and so on. example

from usersettings import Settings as settings
settings.setAppID("com.example.apps.demo")
settings.load()
settings.save()
settings.add()

save()
In a settings dialog, the user clicks "OK" to confirm their changes to settings. The save() function should commit changes. The programmer will call the save function on click.

add(name, value, default)
add(somedict)
The add() function should add them to the settings object. Right now your code adds them one at a time. Programmers should be able to add more than one by passing in a dictionary to your function to update them in batch. A dictionary is just a list of name:value pairs. I'm not sure how the default value is used in the function, so I don't know if this is a bad suggestion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions