Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelchen committed Apr 4, 2019
1 parent f1458c7 commit 602902d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pip install six optenum

3. Operators

`Option` support some operators. See more in [operators.md](./docs/operators.md).
`Option` support some operators. See more in [operators.md](https://github.com/samuelchen/optenum/blob/master/docs/operators.md).

```
>>> class Favorite(Options):
Expand Down Expand Up @@ -176,8 +176,7 @@ Although Python 3.7 comes with [data classes](https://docs.python.org/3/whatsnew

# Boolean for `Option`

`bool`
`is`
No special implementation. It behaves as `object` is.

# Operators for `Option`

Expand All @@ -186,7 +185,7 @@ like `if active_state == MyOption.RUNNING.code: # Do something ...` to check th
are override. Then we could use `if active_state == MyOption.RUNNING:`, `x = MyOption.RUNNING + 1` and so on to
directly reference to its real value.

See doc [operators.md](./docs/operators.md) for override operators.
See doc [operators.md](https://github.com/samuelchen/optenum/blob/master/docs/operators.md) for override operators.

# Collections for `Options`

Expand Down
13 changes: 4 additions & 9 deletions docs/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,24 +392,19 @@ Logic operators are not override. They will perform as the object logic operator
>>> Fruit.BANANA != Favorite.BANANA
True
```

* cmp (Python 2)

Commented as its not required in Python 2.7 and 3

__cmp__ is only used in Python 2. `!=`, or `sort` will use `__cmp__` to compare objects.

Comparing 2 `Option` objects means to compares their `code`.
Comparing an `Option` objects with another type object means to compare the `Option.code` to the other object.
* is

No special implementation for `is`. It behaves as `object`.

* Greater(Equal), Less(Equal), >, >=, <, <=

Comparing 2 `Option` objects means to compares their `code`.
Comparing an `Option` objects with another type object means to compare the `Option.code` to the other object.

* and, or

No special implementation for `and` and `or` operators. It behaviors as its.
No special implementation for `and` and `or` operators. It behaves as its.

```python
>>> Fruit.APPLE and Favorite.BANANA
Expand Down

0 comments on commit 602902d

Please sign in to comment.