API: should ``Layer()`` not derive from ``BaseObject``?
See original GitHub issueSince Layer
is the main interface, it would be nice if tab completion on the object only listed relevant pieces of the API so that you can quickly find what plot types are available (e.g. point()
, bar()
, text()
, etc.)
Currently, since it derives from BaseObject
the namespace is polluted with all sorts of traitlet stuff that the user probably doesn’t care about.
I’d propose something like this:
class LayerObject(BaseObject):
# traitlet-related stuff goes here
def __init__(self, *args, **kwargs):
super(LayerObject, self).__init__(**kwargs)
# etc.
class Layer(object):
# non-traitlet-related Layer methods here
def __init__(self, *args, **kwargs):
if len(args)==1:
self.data = args[0]
self._layerobject = LayerObject(**kwargs)
def point(self):
self.mark = 'point'
return self
# etc.
The only problem would be if we ever want to pass Layer
to some other class this would complicate things. What do you think?
Issue Analytics
- State:
- Created 7 years ago
- Comments:34 (15 by maintainers)
Top Results From Across the Web
Derived type's properties missing in JSON response from ASP ...
This happens when a property uses a derived type; any properties defined in the derived type but not in the base/interface will not...
Read more >OpenLayers v7.1.0 API - Class: BaseObject
Most non-trivial classes inherit from this. This extends Observable with observable properties, where each property is observable as well as the object as...
Read more >Base object (lv_obj) - LVGL documentation
Overview¶. The 'Base Object' implements the basic properties of widgets on a screen, such as: coordinates. parent object. children. main style.
Read more >Maps marker layers show no results when using custom ...
Clients will encounter an issue when plotting a Marker Layer whose Base Object's address location is derived from an object with the API...
Read more >Scripting API: SerializeReference - Unity - Manual
Object; A class derived from a generic type, but not a specific specialization of a generic ... Otherwise only m_Data from Base object...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t feel too strongly about the ordering but like the idea of being consistent with the vegalite examples. So +1 to marking first
Sent from my iPhone
I imagine that as we hit other pain points in configuration, we can come up with more API solutions similar to
mark_point(color='red')
. I landed on this as I went through the basic examples and tried to implement them in Altair. I don’t know what the right solution will be as we go deeper into configs, but I believe that API-wise, exactly mirroring the VegaLite spec should not be our preferred solution.