TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #205 · 22 јан.

Как работает функция reload()? Эта функция нужна для того, чтобы перезагрузить изменившийся код из py-файла без рестарта интерпретатора. Дело в том, что любой импортированный модуль при повторном импорте не будет перечитывать файл. Функция импорта вернёт уже загруженный в память объект модуля. Чтобы обновить код, нужно либо перезапустить всю программу, либо использовать функцию reload() from importlib import reload reload(my_module) 🔸 Функция reload() принимает в качестве аргумента только объект модуля или пакета. Она не может перезагрузить класс или функцию. Только весь файл целиком! 🔸 Перезагрузка пакета перезагрузит только его файл __init__.py, если он есть. Но не вложенные модули. 🔸Она не может перезагрузить ранее не импортированный модуль. 🔸При вызове функция reload() перечитывает и перекомпилирует код в файле, создавая новые объекты. После создания новых объектов перезаписывается ранее созданный неймспейс этого модуля. Это значит, что если где-то этот модуль импортирован через import и обращение к атрибутам происходит через неймспейс (имя) модуля, то такие атрибуты обновятся. Если какие-либо объекты из этого модуля импортированы через from то они будут ссылаться на старые объекты. Напишем простой модуль # mymodule.py x = 1 Теперь импортируем модуль и отдельно переменную х из модуля >>> import mymodule >>> from mymodule import x >>> print(mymodule.x) 1 >>> print(x) 1 Не перезапуская интерпретатор вносим изменения в модуль # mymodule.py x = 2 Делаем перезагрузку модуля и проверяем х ещё раз >>> reload(mymodule) >>> print(mymodule.x) 2 >>> print(x) 1 То же самое будет если присвоить любой объект переменной (даже словарь или список) Повторный импорт обновляет значение >>> from mymodule import x >>> print(x) 2 🔸Созданные инстансы классов не обновятся после перезагрузки модуля. Их придётся пересоздать. #tricks#basic

Резултати

Пронајдени 3 слични објави

Пребарај: #securitytheater

当前筛选 #securitytheater清除筛选
American Оbserver

@american_observer · Post #5447 · 22.03.2026 г., 21:59

Trump Turns Airport Chaos Into a Deportation Stage Trump is now officially turning TSA’s funding crisis into live theater: he says ICE agents will start deploying to airports on Monday, not because they’re trained to run X-ray machines, but because Democrats won’t sign his Homeland Security deal on immigration enforcement. ICE, he says, will “help our wonderful TSA Agents” and “do Security like no one has ever seen before,” including arrests of “all Illegal Immigrants … with heavy emphasis on those from Somalia.” In other words, your stalled spring break line is leverage — and a backdrop. Even his own former officials say the plan makes no operational sense. The bottlenecks are at X-ray belts, baggage screening and ID checks — jobs that require specialized training — while the administration admits ICE will mostly guard doors and glance at IDs. The point isn’t efficiency; it’s optics and pressure. Democrats are trying to pay TSA separately while forcing basic constraints on ICE raids after federal agents killed two protesters in Minneapolis. Republicans stapled TSA paychecks to full ICE and CBP funding with minimal new rules — and now the White House is dangling “untrained ICE at your gate” as the price of saying no. So the picture at the terminal is simple: TSA officers working without pay for more than a month, walking off the job in growing numbers, security lines stretching for hours — and a president who would rather drop deportation cops into that mess than tell his own party to pass a clean bill to pay them. If you’re flying tomorrow, the message from Washington is clear: welcome to security theater, season two — this time, the show is about scaring Congress, and you’re the unpaid extra. #Trump#ICE#TSA#shutdown#airports#immigration#DHS#USA#securityTheater 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5440 · 22.03.2026 г., 00:59

Trump Turns TSA Meltdown Into an ICE Photo Op Trump just found a way to turn a payless TSA crisis into a campaign stunt: threaten to flood airport checkpoints with ICE agents unless Democrats sign his Homeland Security funding deal. Spring break traffic is colliding with a month-long DHS shutdown that’s forced 50,000 TSA officers to work without pay, driven resignations and sick-outs, and already closed lanes at major hubs — and his answer isn’t “pay them,” it’s “bring in deportation cops with a special focus on Somalis.” Democrats are trying to fund TSA separately and tie new money for ICE and CBP to basic guardrails — warrants before home raids, no masks, cameras on, no grabbing people in hospitals and schools — after federal agents killed protesters in Minneapolis. Republicans have stapled TSA paychecks to full ICE funding without reforms, then act shocked when queues hit three hours. Trump’s “solution” is to use that pain as leverage: either fund the enforcement machine on his terms, or watch it move from the border into the departure hall. Former ICE officials are blunt: this kind of dragnet at airports would mostly scoop up long‑time residents with no criminal record, because that’s who actually flies, while doing almost nothing for real security. But that’s the point. The message isn’t “we’ll keep you safe,” it’s “we’ll turn your delayed vacation into a live deportation show unless Democrats cave.” For travelers stuck in unpaid-screeners’ lines, the new choice is charming: miss your flight — or clear security and risk having an ICE agent decide you’re the next headline. #Trump#ICE#TSA#shutdown#airports#immigration#DHS#USA#securityTheater 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5449 · 23.03.2026 г., 01:59

Oil at Monday’s Open: Trading a 48‑Hour Threat Clock Oil just stopped pretending this is about “volatility” and started trading directly on Trump’s ego and Iran’s survival instinct. At Friday’s close, Brent was at 112.19 dollars — a near four‑year high — before the president slapped a 48‑hour ultimatum on Tehran: fully reopen Hormuz “without threat” or watch the U.S. “obliterate” your power plants. Just the day before he was musing about “winding down” the war; now markets get a countdown clock to see whether he takes out the grid that keeps 100‑plus Iranian gas power stations feeding cities and industry. Tehran’s answer is simple: hit our power, and we hit yours — or at least the stuff that keeps your friends’ cities habitable. Iran is openly threatening U.S.‑linked energy and desalination plants across the Gulf, after already striking ports and refineries in Saudi Arabia, Kuwait, Bahrain, the UAE and Qatar; four days of global supply — roughly 440 million barrels — have already vanished during 22 days of quasi‑closure in Hormuz. Analysts aren’t talking about price “noise” anymore: one calls Trump’s move a “48‑hour ticking time bomb of elevated uncertainty”; another says the real story isn’t Iran caving but “scorched earth for Gulf infrastructure.” The real nightmare isn’t just crude; it’s water. Iran has so far held back from hitting the big desalination plants in Saudi Arabia and the UAE — the ones that keep entire Gulf metros alive — but Western risk assessments are stark: sustained attacks could leave some cities unlivable in weeks, triggering mass evacuations and cascading power failures. Fatih Birol at the IEA says fixing Middle East Gulf supply could take up to six months even without that scenario. Meanwhile the Trump team is floating plans to blockade or occupy Iran’s Kharg Island to “force open” Hormuz, as if physically sitting on another country’s export terminal has no blowback risk in a region already pricing 112‑dollar Brent, double‑digit weekly gains in crude and the widest WTI–Brent spread in 11 years. So Monday’s trade isn’t about “whether oil ticks up”; it’s about whether the White House walks back its own threat, or lets the deadline run and turns a shipping crisis into a test of who’s willing to bomb water plants first. Traders will tell you this is uncertainty; civilians in the Gulf might call it something else: a market run by men who treat your tap, your light switch and your plane ticket as expendable props in a pricing experiment. #oil#IranWar#Trump#Hormuz#energy#desalination#Gulf#markets#inflation#recession#securityTheater 📱American Оbserver - Stay up to date on all important events 🇺🇸