Question: I'm trying to find if there's a way to search in lucene to say find all documents where there is at least one word that does not match a particualar word.

E.g. I want to find all documents where there is at least one word besides "test". i.e. "test" may or may not be present but there should be at least one word other than "test". Is there a way to do this in Lucene?

thanks,
Purushotham

Answer: 
Rather than *both* mutating and returning objects, the Python library chooses to have just one way of using the result of a mutator. From `import this`:

> 
> There should be one-- and preferably only one --obvious way to do it.
> 
> 
> 

Having said that, the more usual Python style for what you want to do is using *list comprehensions* or *generator expressions*:

```
[x for x in range(5) if x != 2 and x != 3]

```

You can also chain these together:

```
>>> [x for x in (x for x in range(5) if x != 2) if x != 3]
[0, 1, 4]

```

The above generator expression has the added advantage that it runs in *O(n)* time because Python only iterates over the `range()` once. For large generator expressions, and even for *infinite* generator expressions, this is advantageous.
Neither Python or php have built-in "mutators". You can simply write multiple lines, like

```
a = list(range(5))
a.remove(2)
a.remove(3)

```

If you want to generate a new list, copy the old one beforehand:

```
a = list(range(5))
b = a[:]
b.remove(2)

```

Note that in most cases, a singular call to `remove` indicates you should have used a [`set`](http://docs.python.org/library/stdtypes.html#set) in the first place.