def masked_object(x, value, copy=True, shrink=True):
if isMaskedArray(x):<EOL><INDENT>condition = umath.equal(x._data, value)<EOL>mask = x._mask<EOL><DEDENT>else:<EOL><INDENT>condition = umath.equal(np.asarray(x), value)<EOL>mask = nomask<EOL><DEDENT>mask = mask_or(mask, make_mask(condition, shrink=shrink))<EOL>return masked_array(x, mask=mask, copy=copy, fill_value=value)<EOL>
Mask the array `x` where the data are exactly equal to value.

This function is similar to `masked_values`, but only suitable
for object arrays: for floating point, use `masked_values` instead.

Parameters
----------
x : array_like
    Array to mask
value : object
    Comparison value
copy : {True, False}, optional
    Whether to return a copy of `x`.
shrink : {True, False}, optional
    Whether to collapse a mask full of False to nomask

Returns
-------
result : MaskedArray
    The result of masking `x` where equal to `value`.

See Also
--------
masked_where : Mask where a condition is met.
masked_equal : Mask where equal to a given value (integers).
masked_values : Mask using floating point equality.

Examples
--------
>>> import numpy.ma as ma
>>> food = np.array(['green_eggs', 'ham'], dtype=object)
>>> # don't eat spoiled food
>>> eat = ma.masked_object(food, 'green_eggs')
>>> print eat
[-- ham]
>>> # plain ol` ham is boring
>>> fresh_food = np.array(['cheese', 'ham', 'pineapple'], dtype=object)
>>> eat = ma.masked_object(fresh_food, 'green_eggs')
>>> print eat
[cheese ham pineapple]

Note that `mask` is set to ``nomask`` if possible.

>>> eat
masked_array(data = [cheese ham pineapple],
      mask = False,
      fill_value=?)