class documentation

class BagObj: (source)

View In Hierarchy

BagObj(obj)

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

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"
Parameters
objObject on which attribute look-up is performed.
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): (source)

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

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

def __getattribute__(self, key): (source)

Undocumented

def __init__(self, obj): (source)

Undocumented

Undocumented