Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax update #17

Open
AMDphreak opened this issue Nov 26, 2024 · 0 comments
Open

Syntax update #17

AMDphreak opened this issue Nov 26, 2024 · 0 comments

Comments

@AMDphreak
Copy link

AMDphreak commented Nov 26, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant