awkward-0.x
awkward-0.x copied to clipboard
dynamically created methods are confusing for users
I am teaching about uproot and I found that several methods on a jagged array do not seem to exist, but they can be accessed anyway.
# x is a JaggedArray
dir(x)
['__class__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__get__',
'__getattribute__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__le__',
'__lt__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__self__',
'__self_class__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'__thisclass__',
'_content',
'_counts',
'_isvalid',
'_offsets',
'_parents',
'_starts',
'_stops',
'leafcount']
But x.content
, x.starts
, etc. can be accessed.
Adding a note to this issue: the properties (content
, starts
) are not dynamically created, but there is a __dir__
that is intended to add field names (which are dynamically added because they depend on the data). The __dir__
might not be accounting for the primary methods properly.