Skip to content

Commit

Permalink
Add type variables
Browse files Browse the repository at this point in the history
  • Loading branch information
baniasbaabe committed Jan 30, 2024
1 parent 026f21e commit e20bb87
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions book/pythontricks/Chapter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,32 @@
"for sport in sports:\n",
" print(sport, end=\" \")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Type Variables in Python 3.12"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"class Stack[T]:\n",
" def __init__(self) -> None:\n",
" self.items: List[T] = []\n",
"\n",
" def push(self, item: T) -> None:\n",
" self.items.append(item)"
]
}
],
"metadata": {
Expand Down

0 comments on commit e20bb87

Please sign in to comment.