{ } Raw JSON

bundles / nbformat latest / nbformat / _struct / Struct / __getattr__

function

nbformat._struct:Struct.__getattr__

source: /nbformat/_struct.py:106

Signature

def __getattr__(self, key)

Summary

Get an attr by calling dict.__getitem__.

Extended Summary

Like __setattr__, this method converts KeyError to AttributeError.

Examples

s = Struct(a=10)
s.a
type(s.get)
try:
    s.b
except AttributeError:
    print("I don't have that key")

Aliases

  • nbformat._struct.Struct.__getattr__