[issue27402] Sequence example in typing module documentation does not typecheck

2016-06-27 Thread Michael Lee

New submission from Michael Lee:

In the documentation for the `typing` module, the [entry for the `List` 
type][0] uses the following example to help demonstrate when to use `Sequence` 
vs `List`:

T = TypeVar('T', int, float)

def vec2(x: T, y: T) -> List[T]:
return [x, y]

def slice__to_4(vector: Sequence[T]) -> List[T]:
return vector[0:4]

However, the `slice__to_4` function does not actually typecheck since there's 
no guarantee that a slice of a sequence will return a `List`. For example the 
vector could be a numpy array or a custom subclass of 
`collections.abc.Sequence` with an unusual `__getitem__`. (Mypy correctly 
catches this error and complains about an "Incompatible return value type").

The documentation should probably be updated to use an example that _does_ 
typecheck, though I'm not sure what exactly that example might look like? Maybe 
replace `slice__to_4` with something like this?

def keep_positives(vector: Sequence[T]) -> List[T]:
return [item for item in vector if item > 0]

--
assignee: docs@python
components: Documentation
messages: 269389
nosy: docs@python, michael0x2a
priority: normal
severity: normal
status: open
title: Sequence example in typing module documentation does not typecheck
versions: Python 3.5, Python 3.6

___
Python tracker 
<http://bugs.python.org/issue27402>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27402] Sequence example in typing module documentation does not typecheck

2016-06-27 Thread Michael Lee

Michael Lee added the comment:

Whoops, forgot the link to the error in the docs: 

https://docs.python.org/3/library/typing.html#typing.List

--

___
Python tracker 
<http://bugs.python.org/issue27402>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27644] Expand documentation about type aliases and NewType in the typing module

2016-07-28 Thread Michael Lee

New submission from Michael Lee:

This is a patch to update the documentation on the typing module. It expands 
the section on type aliases and adds a section on [NewType][0].

Since support for NewType was [recently added][1] to mypy, it seemed like a 
prudent time to update the docs to describe this new feature.

The section on type aliases was mainly expanded because the distinction between 
type aliases and NewType could be potentially confusing, so adding extra 
clarification seemed like a good idea.

  [0]: https://www.python.org/dev/peps/pep-0484/#newtype-helper-function
  [1]: https://github.com/python/mypy/pull/1939

--
assignee: docs@python
components: Documentation
files: document_newtype.patch
keywords: patch
messages: 271572
nosy: docs@python, michael0x2a
priority: normal
severity: normal
status: open
title: Expand documentation about type aliases and NewType in the typing module
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file43926/document_newtype.patch

___
Python tracker 
<http://bugs.python.org/issue27644>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27644] Expand documentation about type aliases and NewType in the typing module

2016-07-29 Thread Michael Lee

Michael Lee added the comment:

Ok, here's revision 2 of my patch, after applying the changes from the last 
round of feedback.

--
Added file: http://bugs.python.org/file43939/document_newtype_rev2.patch

___
Python tracker 
<http://bugs.python.org/issue27644>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27688] Expand documentation about Any in the typing module

2016-08-04 Thread Michael Lee

New submission from Michael Lee:

This patch updates the section about `Any` in the typing module. Previously, 
that section was relatively sparse and didn't seem to do a very good job of 
helping the reader understand what the distinction between `Any` and `object` 
is.

This patch expands that section and adds several examples borrowed from the 
mypy docs and PEP 484.

--
assignee: docs@python
components: Documentation
files: object-vs-any.patch
keywords: patch
messages: 272009
nosy: docs@python, gvanrossum, michael0x2a
priority: normal
severity: normal
status: open
title: Expand documentation about Any in the typing module
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44012/object-vs-any.patch

___
Python tracker 
<http://bugs.python.org/issue27688>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27689] Add documentation for typing.Generator

2016-08-04 Thread Michael Lee

New submission from Michael Lee:

This patch adds (previously missing) documentation for `typing.Generator`.

--
assignee: docs@python
components: Documentation
files: document-generators.patch
keywords: patch
messages: 272010
nosy: docs@python, gvanrossum, michael0x2a
priority: normal
severity: normal
status: open
title: Add documentation for typing.Generator
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44013/document-generators.patch

___
Python tracker 
<http://bugs.python.org/issue27689>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27688] Expand documentation about Any in the typing module

2016-08-05 Thread Michael Lee

Michael Lee added the comment:

Here's revision two. The only change I didn't make was the one about the 
isinstance check. It isn't included in PEP 484, and after talking to Guido, he 
decided it wouldn't be appropriate to document it here.

--
Added file: http://bugs.python.org/file44025/object-vs-any-v2.patch

___
Python tracker 
<http://bugs.python.org/issue27688>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27689] Add documentation for typing.Generator

2016-08-05 Thread Michael Lee

Michael Lee added the comment:

Revision two -- I added a brief note mentioning that SendType is contravariant, 
as Ivan suggested.

--
Added file: http://bugs.python.org/file44026/document-generators-v2.patch

___
Python tracker 
<http://bugs.python.org/issue27689>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27689] Add documentation for typing.Generator

2016-08-05 Thread Michael Lee

Michael Lee added the comment:

Revision 3 -- I changed the protocol for the example so that you stop the 
generator by sending in a negative number as a sentinel rather then None.

--
Added file: http://bugs.python.org/file44027/document-generators-v3.patch

___
Python tracker 
<http://bugs.python.org/issue27689>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27723] Document typing.Text and typing.AnyStr

2016-08-09 Thread Michael Lee

New submission from Michael Lee:

This patch documents typing.Text and typing.AnyStr.

I decided against creating a new top-level section to document Text/AnyStr 
mainly because it seems like how exactly str/bytes/unicode is handled by mypy 
and described in PEP 484 might be changing sometime in the future and didn't 
want to add text that would need to be changed later on -- I'm not sure if that 
was the right call or not.

--
assignee: docs@python
components: Documentation
files: document-text-and-anystr.patch
keywords: patch
messages: 272286
nosy: docs@python, gvanrossum, michael0x2a
priority: normal
severity: normal
status: open
title: Document typing.Text and typing.AnyStr
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44062/document-text-and-anystr.patch

___
Python tracker 
<http://bugs.python.org/issue27723>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27723] Document typing.Text and typing.AnyStr

2016-08-15 Thread Michael Lee

Michael Lee added the comment:

Second revision attached below.

--
Added file: http://bugs.python.org/file44121/document-text-and-anystr-2.patch

___
Python tracker 
<http://bugs.python.org/issue27723>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27905] Add documentation for typing.Type

2016-08-30 Thread Michael Lee

New submission from Michael Lee:

This patch adds some documentation for typing.Type[C]. The content itself is 
mostly an abbreviated version of the description from PEP 484 -- let me know if 
the patch is too terse or needs more examples.

--
assignee: docs@python
components: Documentation
files: document-type.patch
keywords: patch
messages: 273974
nosy: docs@python, gvanrossum, michael0x2a
priority: normal
severity: normal
status: open
title: Add documentation for typing.Type
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44285/document-type.patch

___
Python tracker 
<http://bugs.python.org/issue27905>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27905] Add documentation for typing.Type

2016-09-06 Thread Michael Lee

Michael Lee added the comment:

Ok, here's version 2, taking into account Ivan's feedback!

--
Added file: http://bugs.python.org/file44401/document-type-v2.patch

___
Python tracker 
<http://bugs.python.org/issue27905>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28049] Add documentation for typing.Awaitable and friends

2016-09-09 Thread Michael Lee

New submission from Michael Lee:

This patch adds documentation for Awaitable, AsyncIterable, and AsyncIterator 
to the typing module, mostly linking to the corresponding class in 
collections.abc.

It also briefly clarifies the documentation on generators to explain that you 
may use either Iterable or Iterator as the return type of a generator.

--
assignee: docs@python
components: Documentation
files: document-awaitable.patch
keywords: patch
messages: 275379
nosy: docs@python, gvanrossum, michael0x2a
priority: normal
severity: normal
status: open
title: Add documentation for typing.Awaitable and friends
versions: Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file44507/document-awaitable.patch

___
Python tracker 
<http://bugs.python.org/issue28049>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28073] Update documentation about None vs type(None) in typing

2016-09-10 Thread Michael Lee

New submission from Michael Lee:

For some reason, the section of the typing docs about Optional stated that 
Optional[T] was equivalent to Union[T, type(None)]. While this is true, it's 
somewhat inconsistent and potentially confusing since everywhere else in the 
docs, we just use None.

This patch modifies that line to use Union[T, type(None)] instead, and moves 
the line explaining that None is special-cased to mean type(None) to the first 
usage of None as a type within the docs.

--
assignee: docs@python
components: Documentation
files: update-none-vs-type-none.patch
keywords: patch
messages: 275718
nosy: docs@python, gvanrossum, michael0x2a
priority: normal
severity: normal
status: open
title: Update documentation about None vs type(None) in typing
versions: Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file44542/update-none-vs-type-none.patch

___
Python tracker 
<http://bugs.python.org/issue28073>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33129] Add kwarg-only option to dataclass

2020-03-28 Thread Michael Lee


Change by Michael Lee :


--
nosy: +michael.lee
nosy_count: 5.0 -> 6.0
pull_requests: +18569
pull_request: https://github.com/python/cpython/pull/19206

___
Python tracker 
<https://bugs.python.org/issue33129>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33129] Add kwarg-only option to dataclass

2020-03-28 Thread Michael Lee


Michael Lee  added the comment:

Hello! I've submitted a PR based on this issue, since it seemed the most 
relevant from my searching of the backlog.

Here's a link: https://github.com/python/cpython/pull/19206

--

___
Python tracker 
<https://bugs.python.org/issue33129>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com