New submission from Casuall <smile_...@qq.com>:

I learned about type aliases on the 
page(https://docs.python.org/3/library/typing.html), and I found that following 
the code (Vector = list[float])in the tutorial, an error occurred (NameError: 
name 'typing' is not defined) when running.

The following code has the same problem:
  ConnectionOptions = dict[str, str]
  Address = tuple[str, int]
  Server = tuple[Address, ConnectionOptions]

I searched through google and found the correct code:
  from typing import List
  Vector = List[float]

  from typing import Dict, Tuple, Sequence
 
  ConnectionOptions = Dict[str, str]
  Address = Tuple[str, int]
  Server = Tuple[Address, ConnectionOptions]

----------
assignee: docs@python
components: Documentation
messages: 384944
nosy: Smile-zjk, docs@python
priority: normal
severity: normal
status: open
title: Wrong code appears in the type alias introduction

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42910>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to