Skip to content

Commit e5c0743

Browse files
committed
fix: Table issues with vertical bar
1 parent 3b7d075 commit e5c0743

2 files changed

Lines changed: 16 additions & 12 deletions

File tree

chapters/Compatibility.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Most FSharp.Core operators are supported, including formatting with `sprintf`,
4747
| F# Type | Python |
4848
| ----------------- | -------------------------- |
4949
| `Tuple` | `tuple` |
50-
| `Option<T>` | `T \| None` (erased) |
50+
| `Option<T>` | `Optional[T]` (*) |
5151
| `string` | `str` |
5252
| `List<T>` | `List.fs` (immutable list) |
5353
| `Map<K,V>` | `Map.fs` (immutable map) |
@@ -56,6 +56,8 @@ Most FSharp.Core operators are supported, including formatting with `sprintf`,
5656
| Record types | `@dataclass` |
5757
| Anonymous Records | `dict` |
5858
59+
(*) Generated as `T | None` in Python 3.12+
60+
5961
## Interfaces and Protocols
6062
6163
.NET interfaces map to Python protocols and special methods:

chapters/Pydantic.fs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -178,17 +178,19 @@ This pattern is useful when you want to:
178178
179179
F# types map naturally to Python/Pydantic types:
180180
181-
| F# Type | Python Type | Notes |
182-
| ----------- | ------------ | ------------------------------ |
183-
| `string` | `str` | |
184-
| `int` | `int` | |
185-
| `float` | `float` | |
186-
| `bool` | `bool` | |
187-
| `'T option` | `T \| None` | Modern union syntax |
188-
| `'T list` | `list[T]` | |
189-
| `'T array` | `list[T]` | |
190-
| Record | `class` | With `@dataclass` or BaseModel |
191-
| DU | Tagged class | See below |
181+
| F# Type | Python Type | Notes |
182+
| ----------- | ----------------- | ------------------------------ |
183+
| `string` | `str` | |
184+
| `int` | `int` | |
185+
| `float` | `float` | |
186+
| `bool` | `bool` | |
187+
| `'T option` | `Optional[T]` (*) | Modern union syntax |
188+
| `'T list` | `list[T]` | |
189+
| `'T array` | `list[T]` | |
190+
| Record | `class` | With `@dataclass` or BaseModel |
191+
| DU | Tagged class | See below |
192+
193+
(*) Generated as `T | None` in Python 3.12+
192194
193195
### F# Option to Python Union
194196

0 commit comments

Comments
 (0)