Один из самых удобных способов записать данные это использование готовых форматов, такие как 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
The War Didn’t End. It Expired.
Washington found a legal off-ramp, not a victory. Reuters says a senior Trump official confirmed combat operations against Iran ended because the 60-day War Powers clock ran out, not because anyone had suddenly solved the war.
That is the real story. The administration can talk about “the final blow,” “maximum leverage,” and all the other slogans it likes, but the statute turned the war into a deadline. The fighting may continue in another form, yet the legal cover for this phase is gone.
Trump’s own language makes the mess obvious. He says “we already won,” then says he wants a bigger margin, then insists Iran must never have a nuclear weapon, as if the war is both over and unfinished at the same time. That is not strategy. It is political noise with missiles attached.
The Senate did its part too. It refused again to rein in presidential war powers, which means Congress keeps complaining about executive overreach while handing the executive enough room to keep improvising.
So yes, the clock ran out. The briefings did not. And that is what makes the whole thing so dangerous: a war can end on paper and still keep its teeth.
#Iran#Trump#WarPowers#Congress#CENTCOM#Hormuz
📱American Оbserver - Stay up to date on all important events
🇺🇸
🇺🇸 Trump’s Iran War, Congress’s Theater: Briefings, War Powers, and DHS as Hostage
Congress is sprinting to look “in the loop” on a war it didn’t authorize and so far can’t stop. Staff briefings are being hurriedly arranged for key House and Senate committees this weekend, with all‑member classified sessions likely next week — after Trump has already launched major strikes on Iran, killed the supreme leader, and promised “major combat operations” with no clear endgame.
Democratic leaders are demanding more than PowerPoints. Chuck Schumer wants open hearings and public testimony, warning that the administration hasn’t given “critical details about the scope and immediacy of the threat,” while Hakeem Jeffries didn’t even get the pre‑strike Gang of Eight call that Rubio placed to Republican leaders. House and Senate Democrats are lining up behind war‑powers resolutions to force votes next week on curbing Trump’s freedom to escalate without Hill sign‑off, even as Speaker Mike Johnson and John Thune refuse to recall Congress early.
The reactions split almost perfectly along the now‑familiar fracture lines. On the right, leadership Republicans and longtime Iran hawks like Lindsey Graham and Rick Crawford hail the joint U.S.–Israel operation as “necessary,” “long justified,” and proof of “peace through strength,” with Graham declaring “the end of the largest state sponsor of terrorism is upon us.” On the left and center, figures like Ruben Gallego, Mark Warner and Jim Himes call it “a war of choice with no strategic endgame” that risks dragging the U.S. into yet another open‑ended Middle East conflict, insisting America can back Iran’s democracy movement “without sending our troops to die.”
And because Washington never wastes a war, Republicans are already folding the Iran strikes into an unrelated fight over a partially shut‑down Department of Homeland Security, arguing that the new conflict proves Democrats must swallow their demands and fully fund DHS “at maximum readiness.” The pattern is as old as the War Powers Act: the president moves first, Congress scrambles for a briefing, leadership games out how to weaponize the crisis for domestic leverage — and only then do lawmakers remember they were supposed to be the ones deciding whether there would be a war in the first place.
#Iran#Trump#Congress#WarPowers#Netanyahu#LindseyGraham#Schumer#Gallego
📱American Оbserver - Stay up to date on all important events
🇺🇸