# Option Setting Locations¶

The get_location() method of ConfigOpts can be used to determine where the value for an option was set, either by the user or by the application code. The return value is a LocationInfo instance, which includes 2 fields: location and detail.

The location value is a member of the Locations enum, which has 5 possible values. The detail value is a string describing the location. Its value depends on the location.

Value is_user_controlled Description detail
opt_default False The original default set when the option was defined. The source file name where the option is defined.
set_default False A default value set by the application as an override of the original default. This usually only applies to options defined in libraries. The source file name where set_default() or set_defaults() was called.
set_override False A forced value set by the application. The source file name where set_override() was called.
user True A value set by the user through a configuration backend such as a file. The configuration file where the option is set.
command_line True A value set by the user on the command line. Empty string.

## Did a user set a configuration option?¶

Each Locations enum value has a boolean property indicating whether that type of location is managed by the user. This eliminates the need for application code to track which types of locations are user-controlled separately.

loc = CONF.get_location('normal_opt').location
if loc.is_user_controlled:
print('normal_opt was set by the user')
else:
print('normal_opt was set by the application')