nodeca/argparse — pull request #38 by hpaulj (2013-01-04 08:22:31+00:00)
Title: Change Namespace to handle null values as Python does for None

`TestPositionalsNargsOptional` adapted from `test_argparse.py` gives an error
`'AssertionError: {} deepEqual {"foo":null}'`

A dozen other classes in the py test file give similar errors.
The problem is that the JS `Namespace` class treats `null` differently than the python `None`.

Python gives every `dest` at least a `None` value.
The JS `Namespace` tries to treat a `null` value as the same as `undefined`.
However, because sometimes values are set with `Namespace.set()`, and other
times with ordinary object assignment, sometimes a null value appears in
a namespace.

These tests do pass if a modified deepEqual is used, one that ignores
differences between `{bar: null}` and `{}`

Python has a special `Namespace` class because its base `Object` class does
not directly accept attributes. It also defines a nice display method.
The resulting class is essentially the same as the Javascript `object`.

To better match the Python:
- change `namespace.isset()` to use `_.has()` instead of `!!` (`!!null` is `false`)
- remove the null test in `namespace.set()`
- the `_.extend()` alternative is not used.
- `namespace.get()` is not used