:orphan: .. _s_11PytoRuntime6ObjectCyA2CSgKcfc: ``init(_:)`` ============ Initializes from an optional :swift:symbol:`PytoRuntime.Object` and throws :swift:symbol:`PytoRuntime.Interpreter.Error.unhandled` if the object is ``nil``. .. raw:: html .. rubric:: Declaration .. raw:: html
init(
       _ object: Object?
   ) throws
   
.. rubric:: Parameters - **object**: An optional Python object. .. rubric:: Discussion This is useful because the dynamic attribute getter and subscripts return ``nil`` instead of throwing an ``AttributeError``, ``KeyError`` etc. But calling a function returns a non optional value and can throw an error. So to not mix optionals and errors, you can just cast an optional chain with this initializer and it will throw an unhandled error if nil (which anyways is the result of a Python exception).