Browse Source

๐ŸŒ Add Korean translation for `docs/ko/docs/tutorial/extra-data-types.md` (#11711)

pull/11730/head
Nayeon Kim 10 months ago
committed by GitHub
parent
commit
e4d08e9e1f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 130
      docs/ko/docs/tutorial/extra-data-types.md

130
docs/ko/docs/tutorial/extra-data-types.md

@ -0,0 +1,130 @@
# ์ถ”๊ฐ€ ๋ฐ์ดํ„ฐ ์ž๋ฃŒํ˜•
์ง€๊ธˆ๊นŒ์ง€ ์ผ๋ฐ˜์ ์ธ ๋ฐ์ดํ„ฐ ์ž๋ฃŒํ˜•์„ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค:
* `int`
* `float`
* `str`
* `bool`
ํ•˜์ง€๋งŒ ๋” ๋ณต์žกํ•œ ๋ฐ์ดํ„ฐ ์ž๋ฃŒํ˜• ๋˜ํ•œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๊ทธ๋ฆฌ๊ณ  ์ง€๊ธˆ๊นŒ์ง€์™€ ๊ฐ™์€ ๊ธฐ๋Šฅ๋“ค์„ ์—ฌ์ „ํžˆ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
* ํ›Œ๋ฅญํ•œ ํŽธ์ง‘๊ธฐ ์ง€์›.
* ๋“ค์–ด์˜ค๋Š” ์š”์ฒญ์˜ ๋ฐ์ดํ„ฐ ๋ณ€ํ™˜.
* ์‘๋‹ต ๋ฐ์ดํ„ฐ์˜ ๋ฐ์ดํ„ฐ ๋ณ€ํ™˜.
* ๋ฐ์ดํ„ฐ ๊ฒ€์ฆ.
* ์ž๋™ ์–ด๋…ธํ…Œ์ด์…˜๊ณผ ๋ฌธ์„œํ™”.
## ๋‹ค๋ฅธ ๋ฐ์ดํ„ฐ ์ž๋ฃŒํ˜•
์•„๋ž˜์˜ ์ถ”๊ฐ€์ ์ธ ๋ฐ์ดํ„ฐ ์ž๋ฃŒํ˜•์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
* `UUID`:
* ํ‘œ์ค€ "๋ฒ”์šฉ ๊ณ ์œ  ์‹๋ณ„์ž"๋กœ, ๋งŽ์€ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์™€ ์‹œ์Šคํ…œ์—์„œ ID๋กœ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
* ์š”์ฒญ๊ณผ ์‘๋‹ต์—์„œ `str`๋กœ ํ‘œํ˜„๋ฉ๋‹ˆ๋‹ค.
* `datetime.datetime`:
* ํŒŒ์ด์ฌ์˜ `datetime.datetime`.
* ์š”์ฒญ๊ณผ ์‘๋‹ต์—์„œ `2008-09-15T15:53:00+05:00`์™€ ๊ฐ™์€ ISO 8601 ํ˜•์‹์˜ `str`๋กœ ํ‘œํ˜„๋ฉ๋‹ˆ๋‹ค.
* `datetime.date`:
* ํŒŒ์ด์ฌ์˜ `datetime.date`.
* ์š”์ฒญ๊ณผ ์‘๋‹ต์—์„œ `2008-09-15`์™€ ๊ฐ™์€ ISO 8601 ํ˜•์‹์˜ `str`๋กœ ํ‘œํ˜„๋ฉ๋‹ˆ๋‹ค.
* `datetime.time`:
* ํŒŒ์ด์ฌ์˜ `datetime.time`.
* ์š”์ฒญ๊ณผ ์‘๋‹ต์—์„œ `14:23:55.003`์™€ ๊ฐ™์€ ISO 8601 ํ˜•์‹์˜ `str`๋กœ ํ‘œํ˜„๋ฉ๋‹ˆ๋‹ค.
* `datetime.timedelta`:
* ํŒŒ์ด์ฌ์˜ `datetime.timedelta`.
* ์š”์ฒญ๊ณผ ์‘๋‹ต์—์„œ ์ „์ฒด ์ดˆ(seconds)์˜ `float`๋กœ ํ‘œํ˜„๋ฉ๋‹ˆ๋‹ค.
* Pydantic์€ "ISO 8601 ์‹œ์ฐจ ์ธ์ฝ”๋”ฉ"์œผ๋กœ ํ‘œํ˜„ํ•˜๋Š” ๊ฒƒ ๋˜ํ•œ ํ—ˆ์šฉํ•ฉ๋‹ˆ๋‹ค. <a href="https://docs.pydantic.dev/latest/concepts/serialization/#json_encoders" class="external-link" target="_blank">๋” ๋งŽ์€ ์ •๋ณด๋Š” ์ด ๋ฌธ์„œ์—์„œ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค.</a>.
* `frozenset`:
* ์š”์ฒญ๊ณผ ์‘๋‹ต์—์„œ `set`์™€ ๋™์ผํ•˜๊ฒŒ ์ทจ๊ธ‰๋ฉ๋‹ˆ๋‹ค:
* ์š”์ฒญ ์‹œ, ๋ฆฌ์ŠคํŠธ๋ฅผ ์ฝ์–ด ์ค‘๋ณต์„ ์ œ๊ฑฐํ•˜๊ณ  `set`๋กœ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
* ์‘๋‹ต ์‹œ, `set`๋Š” `list`๋กœ ๋ณ€ํ™˜๋ฉ๋‹ˆ๋‹ค.
* ์ƒ์„ฑ๋œ ์Šคํ‚ค๋งˆ๋Š” (JSON ์Šคํ‚ค๋งˆ์˜ `uniqueItems`๋ฅผ ์ด์šฉํ•ด) `set`์˜ ๊ฐ’์ด ๊ณ ์œ ํ•จ์„ ๋ช…์‹œํ•ฉ๋‹ˆ๋‹ค.
* `bytes`:
* ํ‘œ์ค€ ํŒŒ์ด์ฌ์˜ `bytes`.
* ์š”์ฒญ๊ณผ ์‘๋‹ต์—์„œ `str`๋กœ ์ทจ๊ธ‰๋ฉ๋‹ˆ๋‹ค.
* ์ƒ์„ฑ๋œ ์Šคํ‚ค๋งˆ๋Š” ์ด๊ฒƒ์ด `binary` "ํ˜•์‹"์˜ `str`์ž„์„ ๋ช…์‹œํ•ฉ๋‹ˆ๋‹ค.
* `Decimal`:
* ํ‘œ์ค€ ํŒŒ์ด์ฌ์˜ `Decimal`.
* ์š”์ฒญ๊ณผ ์‘๋‹ต์—์„œ `float`์™€ ๋™์ผํ•˜๊ฒŒ ๋‹ค๋ค„์ง‘๋‹ˆ๋‹ค.
* ์—ฌ๊ธฐ์—์„œ ๋ชจ๋“  ์œ ํšจํ•œ pydantic ๋ฐ์ดํ„ฐ ์ž๋ฃŒํ˜•์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค: <a href="https://docs.pydantic.dev/latest/usage/types/types/" class="external-link" target="_blank">Pydantic ๋ฐ์ดํ„ฐ ์ž๋ฃŒํ˜•</a>.
## ์˜ˆ์‹œ
์œ„์˜ ๋ช‡๋ช‡ ์ž๋ฃŒํ˜•์„ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ์‚ฌ์šฉํ•˜๋Š” *๊ฒฝ๋กœ ์ž‘๋™* ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค.
=== "Python 3.10+"
```Python hl_lines="1 3 12-16"
{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
```
=== "Python 3.9+"
```Python hl_lines="1 3 12-16"
{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
```
=== "Python 3.8+"
```Python hl_lines="1 3 13-17"
{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
```
=== "Python 3.10+ non-Annotated"
!!! tip
Prefer to use the `Annotated` version if possible.
```Python hl_lines="1 2 11-15"
{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
```
=== "Python 3.8+ non-Annotated"
!!! tip
Prefer to use the `Annotated` version if possible.
```Python hl_lines="1 2 12-16"
{!> ../../../docs_src/extra_data_types/tutorial001.py!}
```
ํ•จ์ˆ˜ ์•ˆ์˜ ๋งค๊ฐœ๋ณ€์ˆ˜๊ฐ€ ๊ทธ๋“ค๋งŒ์˜ ๋ฐ์ดํ„ฐ ์ž๋ฃŒํ˜•์„ ๊ฐ€์ง€๊ณ  ์žˆ์œผ๋ฉฐ, ์˜ˆ๋ฅผ ๋“ค์–ด, ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋‚ ์งœ๋ฅผ ์กฐ์ž‘ํ•  ์ˆ˜ ์žˆ์Œ์„ ์ฐธ๊ณ ํ•˜์‹ญ์‹œ์˜ค:
=== "Python 3.10+"
```Python hl_lines="18-19"
{!> ../../../docs_src/extra_data_types/tutorial001_an_py310.py!}
```
=== "Python 3.9+"
```Python hl_lines="18-19"
{!> ../../../docs_src/extra_data_types/tutorial001_an_py39.py!}
```
=== "Python 3.8+"
```Python hl_lines="19-20"
{!> ../../../docs_src/extra_data_types/tutorial001_an.py!}
```
=== "Python 3.10+ non-Annotated"
!!! tip
Prefer to use the `Annotated` version if possible.
```Python hl_lines="17-18"
{!> ../../../docs_src/extra_data_types/tutorial001_py310.py!}
```
=== "Python 3.8+ non-Annotated"
!!! tip
Prefer to use the `Annotated` version if possible.
```Python hl_lines="18-19"
{!> ../../../docs_src/extra_data_types/tutorial001.py!}
```
Loadingโ€ฆ
Cancel
Save