Files
typeshed/stdlib/3
Roy Williams 6008b9dbb1 Overload signature of get to return an Optional value and to allow default to take any type to match runtime behavior.
This chage more closely matches the behavior of `get` at runtime.  Users can pass whatever they want in to the default
parameter and it will be returned if the key is absent.  Additionally, `get` should return an `Optional` if called with
only one parameter.

```python
z = {'a': 22}
reveal_type(z.get('b'))
reveal_type(z.get('b', 22))
reveal_type(z.get('b', 'hello'))
```

Before:
```shell
test_get_default.py:2: error: Revealed type is 'builtins.int*'
test_get_default.py:3: error: Revealed type is 'builtins.int*'
test_get_default.py:4: error: Revealed type is 'builtins.int*'
test_get_default.py:4: error: Argument 2 to "get" of "dict" has incompatible type "str"; expected "int"
```

After:
```shell
test_get_default.py:2: error: Revealed type is 'Union[builtins.int*, builtins.None]'
test_get_default.py:3: error: Revealed type is 'builtins.int'
test_get_default.py:4: error: Revealed type is 'Union[builtins.int, builtins.str*]'
```
2017-01-11 22:02:29 -08:00
..
2016-12-20 02:28:12 -08:00
2016-12-21 01:15:26 -08:00
2016-12-19 22:09:35 -08:00
2016-12-21 01:15:26 -08:00
2016-12-21 01:06:52 -08:00
2017-01-04 13:38:05 -08:00
2016-12-20 02:28:12 -08:00
2016-12-20 02:28:12 -08:00
2016-12-19 22:09:35 -08:00
2016-12-20 02:28:12 -08:00
2016-12-19 22:09:35 -08:00
2016-12-19 23:53:19 -08:00
2016-12-19 22:09:35 -08:00
2016-12-28 11:13:57 -08:00
2016-12-19 23:53:19 -08:00
2016-04-11 00:27:58 -04:00
2016-12-19 23:53:19 -08:00
2016-12-19 22:09:35 -08:00
2016-12-21 01:06:52 -08:00
2016-12-21 01:15:26 -08:00
2016-05-04 16:54:57 -07:00
2016-12-19 22:09:35 -08:00
2016-12-19 22:09:35 -08:00
2016-12-20 01:54:34 -08:00
2016-12-21 01:15:26 -08:00
2016-05-17 14:32:03 +01:00
2016-12-19 22:09:35 -08:00
2016-12-19 22:09:35 -08:00
2016-12-20 00:16:44 -08:00
2016-12-19 22:09:35 -08:00
2016-12-19 22:09:35 -08:00
2016-12-19 23:53:19 -08:00
2016-07-05 10:18:58 -07:00
2016-12-20 00:47:51 -08:00
2016-12-19 21:52:56 -08:00
2016-12-20 00:16:44 -08:00
2016-05-03 11:48:38 -07:00
2016-08-24 06:08:46 -07:00
2016-07-26 07:43:29 -07:00
2016-12-19 22:09:35 -08:00
2016-12-19 22:09:35 -08:00
2016-02-25 09:41:32 +00:00
2015-12-30 21:59:56 +01:00
2016-12-19 22:09:35 -08:00
2016-12-19 22:09:35 -08:00
2016-12-19 22:09:35 -08:00
2016-12-19 22:09:35 -08:00
2016-12-19 22:09:35 -08:00
2017-01-04 13:38:05 -08:00
2016-12-19 22:09:35 -08:00
2016-12-20 02:28:12 -08:00
2016-12-20 00:47:51 -08:00
2016-12-19 22:09:35 -08:00
2016-12-19 22:09:35 -08:00
2016-12-28 10:24:50 -08:00
2016-12-19 22:09:35 -08:00