class documentation

class BagObj:

View In Hierarchy

BagObj(obj)

Convert attribute look-ups to getitems on the object passed in.

Parameters

obj : class instance
Object on which attribute look-up is performed.

Examples

>>> from numpy.lib.npyio import BagObj as BO
>>> class BagDemo:
...     def __getitem__(self, key): # An instance of BagObj(BagDemo)
...                                 # will call this method when any
...                                 # attribute look-up is required
...         result = "Doesn't matter what you want, "
...         return result + "you're gonna get this"
...
>>> demo_obj = BagDemo()
>>> bagobj = BO(demo_obj)
>>> bagobj.hello_there
"Doesn't matter what you want, you're gonna get this"
>>> bagobj.I_can_be_anything
"Doesn't matter what you want, you're gonna get this"
Method __dir__ Enables dir(bagobj) to list the files in an NpzFile.
Method __getattribute__ Undocumented
Method __init__ Undocumented
Instance Variable ​_obj Undocumented
def __dir__(self):

Enables dir(bagobj) to list the files in an NpzFile.

This also enables tab-completion in an interpreter or IPython.

def __getattribute__(self, key):

Undocumented

def __init__(self, obj):

Undocumented

_obj =

Undocumented