Skip to content

Commit

Permalink
Add new note about Memory management in Python, image for this note a…
Browse files Browse the repository at this point in the history
…nd try to add Search and Copy code functions
  • Loading branch information
NoisyCake committed Jul 16, 2024
1 parent 95c5f23 commit 1aa5f50
Show file tree
Hide file tree
Showing 120 changed files with 9,919 additions and 543 deletions.
2 changes: 1 addition & 1 deletion config/_default/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ publishDir = "docs"
# pluralizeListTitles = "true" # hugo function useful for non-english languages, find out more in https://gohugo.io/getting-started/configuration/#pluralizelisttitles

enableRobotsTXT = true
paginate = 15
paginate = 30
summaryLength = 0

buildDrafts = false
Expand Down
6 changes: 3 additions & 3 deletions config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ defaultAppearance = "dark" # valid options: light or dark
autoSwitchAppearance = true
favicon = "favicon.ico"

enableSearch = false
enableCodeCopy = false
enableSearch = true
enableCodeCopy = true

# mainSections = ["notes"]
# robots = ""
Expand All @@ -24,7 +24,7 @@ defaultFeaturedImage = "/img/traffic.svg" # used as default for featured images

highlightCurrentMenuArea = true
smartTOC = true
smartTOCHideUnfocusedChildren = true
smartTOCHideUnfocusedChildren = false

[header]
layout = "fixed-fill-blur" # valid options: basic, fixed, fixed-fill, fixed-gradient, fixed-fill-blur
Expand Down
9 changes: 7 additions & 2 deletions content/posts/Mark_Lutz/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,17 @@ tags: ["python"]
### Что нового
* Unicode — это стандарт, который определяет уникальные числовые коды (code points) для каждого символа в различных письменных системах мира; UTF-8 (Unicode Transformation Format) — кодировка, представляющая эти числовые коды в последовательности байтов.

* Существует стиль форматирования строк, в котором используются `%`. Пользоваться им нет смысла, так как существуют более свежие и быстрые альтернативы (f-string), но полезно для общего развития. Пример:
* Существует стиль форматирования строк, в котором используются `%`. Лично я не вижу смысла им пользоваться, так как существуют более свежие и быстрые альтернативы (`f-strings`, `format()`), но полезно для общего развития. Пример:
```py
name = "Ivan"
print('Hello, %s' % name)
print('%s, my friend %s' % ('Hello', name))
```

# Вывод: Hello, my friend Ivan
```
# Вывод:
Hello, Ivan
Hello, my friend Ivan
```

* Забывшееся: в один принт можно читабельно (без прописывания литералов) уместить многострочный текст, обрамляя его тремя парами кавычек:
Expand Down
2 changes: 1 addition & 1 deletion content/posts/collections/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ draft: false
description: ""
tags: ["python", "datatypes"]
series: ["Python"]
series_order: 1
series_order: 2
---

{{< lead >}}
Expand Down
2 changes: 1 addition & 1 deletion content/posts/csv_json/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ draft: false
description: ""
tags: ["python", "files", "modules"]
series: ["Python"]
series_order: 10
series_order: 11
---

{{< lead >}}
Expand Down
2 changes: 1 addition & 1 deletion content/posts/date_and_time_1/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ draft: false
description: ""
tags: ["python", "datetime", "date", "modules", "datatypes"]
series: ["Python"]
series_order: 7
series_order: 8
---

{{< lead >}}
Expand Down
2 changes: 1 addition & 1 deletion content/posts/date_and_time_2/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ draft: false
description: ""
tags: ["python", "time", "calendar", "modules", "datatypes"]
series: ["Python"]
series_order: 8
series_order: 9
---

{{< lead >}}
Expand Down
13 changes: 11 additions & 2 deletions content/posts/deep_bool_oper_python/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ print(not 1 == 2 or 3 == 3 and 5 == 6)
# Вывод: True
```

Согласно приоритету операторов в первую очередь вычисляются выражения `1 == 2`, `3 == 3` и `5 == 6`, в результате чего исходное выражение принимает вид `not False or True and False`. Далее выполняется оператор `not`, возвращая значение `True`, после него — оператор `and`, возвращая значение `False`. Выражение принимает вид `True or False`. Последним выполняется оператор `or`, возвращая общий результат выражения — значение `True` !(считаю это неточным утверждением, ведь оператор `or` может сразу завершать работу после вычисления `not 1 == 2`, что подтвердилось в ходе проверки)!.
Согласно приоритету операторов в первую очередь вычисляются выражения `1 == 2`, `3 == 3` и `5 == 6`, в результате чего исходное выражение принимает вид `not False or True and False`. Далее выполняется оператор `not`, возвращая значение `True`, после него — оператор `and`, возвращая значение `False`. Выражение принимает вид `True or False`. Последним выполняется оператор `or`, возвращая общий результат выражения — значение `True`.
P.S. На самом деле после вычиления `not 1 == 2` оператор `or` сразу вернёт `True`, не вычисляя правую часть.

---
## Цепочки сравнений
Expand Down Expand Up @@ -213,4 +214,12 @@ print(a == b in [True])
# Вывод:
False
False
```
```

---

**Основной источник:** https://habr.com/ru/articles/824170/

Доп. источники:
* https://docs-python.ru/tutorial/operatsii-and-or-not-python/
* https://stackoverflow.com/questions/39983695/what-is-truthy-and-falsy-how-is-it-different-from-true-and-false
2 changes: 1 addition & 1 deletion content/posts/frac_dec_compl/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ draft: false
description: ""
tags: ["python", "datatypes"]
series: ["Python"]
series_order: 3
series_order: 4
---

{{< lead >}}
Expand Down
2 changes: 1 addition & 1 deletion content/posts/functions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ draft: false
description: ""
tags: ["python", "functions"]
series: ["Python"]
series_order: 5
series_order: 6
---

{{< lead >}}
Expand Down
Binary file added content/posts/memory_python/arena.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/posts/memory_python/arena_pool_block.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/posts/memory_python/feature.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1aa5f50

Please sign in to comment.