-
-
Notifications
You must be signed in to change notification settings - Fork 791
Description
What is the problem or limitation you are having?
Currently the accessors argument is required when creating a ListSource or TreeSource but it is only used when converting sequential data (like lists and tuples) to Row or Node objects. For data sources where rows are completely constructed from mappings it is redundant. The accessors are also a private data item so there is no public way for a user of the data source to ask how sequential data should be supplied.
Describe the solution you'd like
Make the accessors argument optional, and rather than raising an error when constructing the data source, instead only error if it is absent and the user actually supplies a sequential data value for a row if the accessors are not supplied then treat sequences as opaque objects and pass them as {'value': data} to the Row's __init__ method (perhaps after converting them to tuple so they are immutable).
Also make it a public read-only attribute (perhaps as accessor_order or something similar).
Describe alternatives you've considered
Keeping the status-quo. It works. This is just streamlining the API.
Additional context
This came out of this comment: https://github.com/beeware/toga/pull/4042/changes#r2680642184