def view(self, dtype=None, type=None, fill_value=None):
if dtype is None:<EOL><INDENT>if type is None:<EOL><INDENT>output = ndarray.view(self)<EOL><DEDENT>else:<EOL><INDENT>output = ndarray.view(self, type)<EOL><DEDENT><DEDENT>elif type is None:<EOL><INDENT>try:<EOL><INDENT>if issubclass(dtype, ndarray):<EOL><INDENT>output = ndarray.view(self, dtype)<EOL>dtype = None<EOL><DEDENT>else:<EOL><INDENT>output = ndarray.view(self, dtype)<EOL><DEDENT><DEDENT>except TypeError:<EOL><INDENT>output = ndarray.view(self, dtype)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>output = ndarray.view(self, dtype, type)<EOL><DEDENT>if (getattr(output, '<STR_LIT>', nomask) is not nomask):<EOL><INDENT>if dtype is None:<EOL><INDENT>dtype = output.dtype<EOL><DEDENT>mdtype = make_mask_descr(dtype)<EOL>output._mask = self._mask.view(mdtype, ndarray)<EOL>try:<EOL><INDENT>output._mask.shape = output.shape<EOL><DEDENT>except (AttributeError, TypeError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if getattr(output, '<STR_LIT>', None) is not None:<EOL><INDENT>if fill_value is None:<EOL><INDENT>if dtype is None:<EOL><INDENT>pass <EOL><DEDENT>else:<EOL><INDENT>output._fill_value = None<EOL><DEDENT><DEDENT>else:<EOL><INDENT>output.fill_value = fill_value<EOL><DEDENT><DEDENT>return output<EOL>
Return a view of the MaskedArray data

Parameters
----------
dtype : data-type or ndarray sub-class, optional
    Data-type descriptor of the returned view, e.g., float32 or int16.
    The default, None, results in the view having the same data-type
    as `a`. As with ``ndarray.view``, dtype can also be specified as
    an ndarray sub-class, which then specifies the type of the
    returned object (this is equivalent to setting the ``type``
    parameter).
type : Python type, optional
    Type of the returned view, e.g., ndarray or matrix.  Again, the
    default None results in type preservation.

Notes
-----

``a.view()`` is used two different ways:

``a.view(some_dtype)`` or ``a.view(dtype=some_dtype)`` constructs a view
of the array's memory with a different data-type.  This can cause a
reinterpretation of the bytes of memory.

``a.view(ndarray_subclass)`` or ``a.view(type=ndarray_subclass)`` just
returns an instance of `ndarray_subclass` that looks at the same array
(same shape, dtype, etc.)  This does not cause a reinterpretation of the
memory.

If `fill_value` is not specified, but `dtype` is specified (and is not
an ndarray sub-class), the `fill_value` of the MaskedArray will be
reset. If neither `fill_value` nor `dtype` are specified (or if
`dtype` is an ndarray sub-class), then the fill value is preserved.
Finally, if `fill_value` is specified, but `dtype` is not, the fill
value is set to the specified value.

For ``a.view(some_dtype)``, if ``some_dtype`` has a different number of
bytes per entry than the previous dtype (for example, converting a
regular array to a structured array), then the behavior of the view
cannot be predicted just from the superficial appearance of ``a`` (shown
by ``print(a)``). It also depends on exactly how ``a`` is stored in
memory. Therefore if ``a`` is C-ordered versus fortran-ordered, versus
defined as a slice or transpose, etc., the view may give different
results.