You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 toload()
save()
etc, instead ofs.load_settings()
and so on. examplesave()
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.The text was updated successfully, but these errors were encountered: