LINUX.ORG.RU

История изменений

Исправление serg002, (текущая версия) :


#!/usr/local/bin/python3.9
# -*- coding: UTF-8 -*-


from typing import (
    NewType,
    List,
    TypedDict,
)

class Point2D(TypedDict):
    x: str
    y: int
    label: str


def aaa(x: List[Point2D]):
    print("zzzz")
    print(x)

zzz = {'x': 1, 'y': 2.2, 'label': 'good'}
try:
    aaa(zzz)    
except TypeError as e:
    print(e)

$./test.py ``` {‘x’: 1, ‘y’: 2.2, ‘label’: ‘good’}


Не получается

Исправление serg002, :

#!/usr/local/bin/python3.9
# -*- coding: UTF-8 -*-


from typing import (
    NewType,
    List,
    TypedDict,
)

class Point2D(TypedDict):
    x: str
    y: int
    label: str


def aaa(x: List[Point2D]):
    print("zzzz")
    print(x)

zzz = {'x': 1, 'y': 2.2, 'label': 'good'}
try:
    aaa(zzz)    
except TypeError as e:
    print(e)

$./test.py ``` {‘x’: 1, ‘y’: 2.2, ‘label’: ‘good’}


Не получается

Исправление serg002, :

#!/usr/local/bin/python3.9
# -*- coding: UTF-8 -*-


from typing import (
    NewType,
    List,
    TypedDict,
)

class Point2D(TypedDict):
    x: str
    y: int
    label: str


def aaa(x: List[Point2D]):
    print("zzzz")
    print(x)

zzz = {'x': 1, 'y': 2.2, 'label': 'good'}
try:
    aaa(zzz)    
except TypeError as e:
    print(e)

$./test.py ``` {‘x’: 1, ‘y’: 2.2, ‘label’: ‘good’}


Не получается

Исходная версия serg002, :

#!/usr/local/bin/python3.9
# -*- coding: UTF-8 -*-


from typing import (
    NewType,
    List,
    TypedDict,
)

class Point2D(TypedDict):
    x: str
    y: int
    label: str


def aaa(x: List[Point2D]):
    print("zzzz")
    print(x)

zzz = {'x': 1, 'y': 2.2, 'label': 'good'}
try:
    aaa(zzz)    
except TypeError as e:
    print(e)

$./test.py ``` {‘x’: 1, ‘y’: 2.2, ‘label’: ‘good’}


Не получается