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 слични објави

Пребарај: #easternconference

当前筛选 #easternconference清除筛选
Crypto M - Crypto News

@CryptoM · Post #65087 · 10.04.2026 г., 23:24

🚀 Polymarket Sees Significant Bet on Hornets vs. Pistons NBA Game A notable transaction has occurred on Polymarket regarding the NBA regular season game between the Charlotte Hornets and the Detroit Pistons. According to Odaily, an account with a 43% win rate, identified by the address 0xe0f01e5ce19e71138a1fc77d3b466f50b7f3bad3, has purchased $200,000 worth of shares predicting a Hornets victory at an average price of 66 cents. The game between the Hornets and Pistons began today at 7 a.m. UTC+8. As the NBA regular season nears its conclusion, the Hornets hold a record of 43 wins and 37 losses, placing them 9th in the Eastern Conference. Meanwhile, the Pistons lead the Eastern Conference with 58 wins and 22 losses. #Polymarket#NBA#Hornets#Pistons#SportsBetting#Basketball#EasternConference

Crypto M - Crypto News

@CryptoM · Post #65329 · 12.04.2026 г., 23:24

🚀 NBA Regular Season: Magic Lead Celtics at Halftime In the Polymarket prediction event for the NBA regular season game between the Orlando Magic and the Boston Celtics, a user with significant earnings of over $1.8 million has invested more than $370,000 on the Magic to win with a 10.5-point spread at an average opening price of 57.9¢. Additionally, the user placed $30,000 on the Magic to win with a 12.5-point spread at an average opening price of 52¢. According to Odaily, the game, which started at 6 a.m. UTC+8, is currently at halftime with the Magic leading 61-52. Today marks the final day of the NBA regular season, with the Magic holding a record of 45 wins and 36 losses, placing them 7th in the Eastern Conference. The Celtics, with a record of 55 wins and 26 losses, are ranked 2nd in the Eastern Conference. #NBA#OrlandoMagic#BostonCeltics#Polymarket#basketball#EasternConference#MagicLead#NBARegularSeason#sportsbetting#halftime

Crypto M - Crypto News

@CryptoM · Post #64783 · 09.04.2026 г., 23:05

🚀 High-Stakes Bet on Bulls vs. Wizards NBA Game A significant wager has been placed on the Polymarket prediction platform regarding the NBA regular season game between the Chicago Bulls and the Washington Wizards. According to Odaily, an account with a history of over $4.3 million in losses has invested $150,000 on the Bulls to win against the Wizards with a 5.5-point spread, at an average opening price of 56 cents. Additionally, the same account has placed a $40,000 bet on the Bulls to win with a 6.5-point spread, at an average opening price of 50.9 cents. The NBA regular season game between the Bulls and the Wizards commenced today at 7 a.m. UTC+8. As the season nears its conclusion, the Bulls hold a record of 30 wins and 49 losses, placing them 12th in the Eastern Conference. Meanwhile, the Wizards have a record of 17 wins and 62 losses, ranking 15th in the Eastern Conference. #HighStakesBet#BullsVsWizards#NBA#Polymarket#ChicagoBulls#WashingtonWizards#NBASeason#Betting#SportsBetting#PointSpread#BasketballBetting#EasternConference