Один из самых удобных способов записать данные это использование готовых форматов, такие как JSON или YAML.
Из плюсов такого подхода стоит отметить вот что:
🔸 готовый, повсеместно используемый и поддерживаемый формат
🔸 простой и понятный файл, удобочитаемый для человека
🔸 можно легко редактировать в любом текстовом редакторе без специальных программ и библиотек
Но есть и минусы
🔹 затраты времени при записи файла (кодирование данных в нужный формат строки)
🔹 затраты времени при чтении файла (декодирование данных в Python объекты)
🔹 размер файла увеличивается из-за разметки данных (скобки, запятые, переносы, отступы...)
🔹 перед записью все данные должны быть помещены в память в полном объёме (не всегда)
🔹 при чтении необходимо считать весь файл в память и только потом декодировать данные
Если нужно писать немного данных в несколько файлов, то затраты по времени не ощутимы. Обычно это файлы конфига или какие-либо метаданные. Это отличный вариант под такие задачи.
Есть и другой поход к записи файлов - это бинарные файлы. Используется, когда данных достаточно много и никто их не собирается читать глазками😳.
🔸 очень быстрая запись
🔸 чтение значительно быстрей чем JSON, YAML итд
🔸 размер файла значительно меньше, так как нет разметки
🔸 можно записывать данные по мере поступления не загружая всё в память
🔸 можно извлечь любую часть данных независимо
Из минусов
🔹 нужно определить свой формат записи данных (если не используете готовую спецификацию определённого формата)
🔹 не получится открыть файл и визуально понять что там записано, а для чтения файла потребуется знать его спецификацию.
🔹 не так-то просто создать такой файл без специальной библиотеки
В таком виде удобно записывать большой массив любых однородных данных. Например, мониторинг валютной биржи или кэшированная анимация 3D геометрии.
(Это не означает что нельзя записать данные разного типа, просто это будет не так удобно)
Представьте себе JPG-картинку. По сути это немного мета-информации и большой массив пикселей. Тоже самое со звуком или видео файлом. Поэтому, если вы попробуете открыть картинку в текстовом редакторе вы увидите что-то вроде такого
f15d cd29 a564 4578 ...
09e2 9bc4 a696 1253 ...
84e9 4de1 3b23 c24a ...
2534 5161 28e0 709d ...
...
Это и есть записанные байтики. И для их чтения требуется определённый софт который знает что с ними делать. Под каждый тип файла.
К чему это я? Читайте в следующем посте...
#tricks#basic
On 'big-game hunters'
What if I tell you that one man formulated the whole of the folklore tradition of Stone Age big-game hunters -- hunting magic, initiation ceremonies, dancing shamans, pregnant horses, nubile naked women -- and even an art-historical development of imagery?
Your entire perception of the Paleolithic and Neolithic was defined by Abbé Breuil🔗, a Catholic priest in the early 20th century.
Of course, this -- reconstructing prehistory on the basis of contemporary behavior and thinking -- is exactly what should NOT be done. But Breuil did it.
The idea of "initiation ceremonies" was derived from one set of small heel prints, supposedly of children, in one alcove in one cave. This is the sort of single data point through which any number of lines could be graphed. It begged to be equated with initiation rites of contemporary primitives by anthropologists.
Overall there needs to be a re-evaluation of data, considering the developing consciousness of man.
#anthropology
@EuropeanTribalism
Anthropologist Madhumala Chattopadhyay, took part in the only successful, nonviolent expeditions to the Sentinel Islands, this is extremely rare given the islands’ usual hostility to outsiders.
She was the only woman to go along on such expeditions, where all other expeditions failed.
Contacting them is illegal, the community must be left alone.
For their safety.
[Read for yourself here]
@googlefactss#anthropology#sentinel
🌎 The San people of southern Africa tell legends of the /Kaggen, a trickster deity that often takes the form of a praying mantis. These stories, documented by 19th-century ethnographers, reflect the San’s deep connection to animals and the land. There are over 450 recorded San myths collected in the Bleek and Lloyd archive. ✨
#mythology⚡#Africa⚡#anthropology
👉subscribe Interesting Planet
👉more Channels
🌎 In Madagascar, the turning of the bones ceremony, or Famadihana, sees families exhume ancestors, rewrap the remains in fresh cloth, and dance with the bodies to live music. This ritual, held every seven years, honors lineage and strengthens family bonds. ✨
#traditions⚡#anthropology⚡#Madagascar
👉subscribe Interesting Planet
👉more Channels
🌎 For centuries, residents of Whittlesea, South Africa, have participated in the Intonjane ritual—a traditional female initiation ceremony. Young women undergo seclusion, teachings about adulthood, and symbolic rituals marking the transition to womanhood. Anthropologists report Intonjane is practiced mainly among Xhosa communities and usually lasts about a week. ✨
#culture⚡#traditions⚡#anthropology
👉subscribe Interesting Planet
👉more Channels
🌎 In Papua New Guinea, the Korowai people still build treehouses perched up to 35 meters above ground. This tradition began as a way to avoid floods, wild animals, and rival clans. Some Korowai treehouses even have separate “guest” platforms for visitors or ritual gatherings. ✨
#anthropology⚡#traditions⚡#rituals
👉subscribe Interesting Planet
👉more Channels
🌎 In Vanuatu, the Naghol or "land diving" ritual involves men jumping from tall wooden towers with vines tied to their ankles. This dangerous tradition, practiced on Pentecost Island, is meant to ensure a good yam harvest. Some platforms are over 20 meters high, and proper vine length is crucial to prevent injury. ✨
#traditions⚡#anthropology⚡#rituals
👉subscribe Interesting Planet
👉more Channels
🌎 In Indonesia’s Tana Toraja region, families celebrate Ma’nene, a ritual where they exhume deceased relatives, clean their bodies, and dress them in fresh clothes. This custom honors ancestors and reinforces family ties. Some mummies are carried through the village during the ceremony, which happens every few years. ✨
#tradition⚡#anthropology⚡#festival
👉subscribe Interesting Planet
👉more Channels
🌎 In Papua New Guinea, the Kaningara people of the Sepik River region perform a crocodile-scarification ritual. Teenage boys undergo elaborate skin-cutting ceremonies that create raised scars resembling crocodile scales, symbolizing a spiritual connection with the river’s sacred crocodiles. The process involves hundreds of cuts and can last several hours. ✨
#ritual⚡#anthropology⚡#tradition
👉subscribe Interesting Planet
👉more Channels
🌎 In the folklore of the Ainu people from Japan's Hokkaido region, the kamuy are powerful spirits thought to control natural forces like weather and animals. Early ethnographers documented dozens of distinct kamuy, each responsible for maintaining harmony between humans and the environment. ✨
#mythology⚡#cultures⚡#anthropology
👉subscribe Interesting Planet
👉more Channels
Igbo‑Ora, Nigeria — nicknamed the 'Twin Capital' — reports twin birth rates around 4–5% (~40–50 per 1,000), far above the global average (~1–1.5% or 10–15 per 1,000). Nearby Yoruba communities and parts of Benin show similar rates. (Figures approximate.)"
@googlefactss#Nigeria#anthropology#twins
🌎 In the Indonesian village of Trunyan, the dead are laid out on the ground and covered with bamboo cages instead of being buried. The local Taru Menyan tree releases a natural fragrance that masks odors, allowing bodies to decompose above ground without attracting scavengers. ✨
#rituals⚡#anthropology⚡#Indonesia
👉subscribe Interesting Planet
👉more Channels