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

Резултати

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

Пребарај: #launch

当前筛选 #launch清除筛选
SpaceX

@SpaceX · Post #10307 · 14.02.2024 г., 18:58

🚀Next launchStarlinkGroup7-14 RocketFalcon9Block5 FromSLC-4E,VandenbergSFB🇺🇸 🕙Launch time February 15th, 01:34 UTC🆕 🌍Mission information TypeCommunications OrbitLowEarthOrbit 🚀Vehicle information CoreB1082.2(2ndflight♻️) LandingOCISLY(ASDS🌊) ℹ️ A batch of 22 satellites for the Starlink mega-constellation - SpaceX's project for space-based Internet communication system. #Launch

Hashtags

SpaceX

@SpaceX · Post #10306 · 14.02.2024 г., 18:33

🚀Next launchUSSF-124 RocketFalcon9Block5 FromSLC-40,CapeCanaveral🇺🇸 🕙Launch time February14th,22:30UTC 🌍Mission information TypeGovernment/TopSecret OrbitLowEarthOrbit 🚀Vehicle information CoreB1078.7(7thflight♻️) LandingLZ-2(RTLS) ℹ️ 2 satellites, one by L3Harris and the other by Northrop Grumman, will be launched as the Hypersonic and Ballistic Tracking Space Sensor (HBTSS) mission for the US Missile Defense Agency. These satellites have improved sensitivity to detect and track hypersonic missiles with fainter signatures. #Launch

Hashtags

SpaceX

@SpaceX · Post #10290 · 12.02.2024 г., 23:47

🚀Next launchNova-CIM-1 RocketFalcon9Block5 FromLC-39A,KennedySpaceCenter🇺🇸 🕙Launch time February15th,06:05 UTC 🆕 🌍Mission information TypeLunarExploration OrbitLunarOrbit 🚀Vehicle information CoreB1060.18(18thflight♻️) LandingLZ-1(RTLS) ℹ️ This is the first flight of Nova-C lander which was developed by Intuitive Machines. This mission is a part of CLPS program and carries various NASA payloads in support of Artemis lunar program, as well as multiple commercial payloads. #Launch

Hashtags

SpaceX

@SpaceX · Post #10130 · 29.12.2023 г., 01:38

🚀Next launchStarlinkGroup6-36 RocketFalcon9Block5 FromSLC-40,CapeCanaveral🇺🇸 🕙Launch time December29th,04:01UTC 🌍Mission information TypeCommunications OrbitLowEarthOrbit 🚀Vehicle information CoreB1069.12 (12thflight♻️) LandingASOG(ASDS🌊) ℹ️ A batch of satellites for the Starlink mega-constellation. #Launch

Hashtags

SpaceX

@SpaceX · Post #10119 · 27.12.2023 г., 14:34

🚀Next launchOTV-7(X-37B)(USSF-52) RocketFalconHeavy FromLC-39A,KennedySpaceCenter🇺🇸 🕙Launch time December29th,01:07UTC 🌍Mission information TypeGovernment/TopSecret OrbitUnknown 🚀Vehicle information CoreB1084.1(1stflight🌟) ExpendableLastflight🌠 Boosters B1064.5(♻️x4) (RTLS: LZ-1) B1065.5(♻️x4) (RTLS: LZ-2) ℹ️ It is the seventh flight of the 📷X-37B program. United States Air Force Orbital Test Vehicle is built by Boeing. #Launch

Hashtags

SpaceX

@SpaceX · Post #10075 · 23.12.2023 г., 11:34

🚀Next launchSARah2&3 RocketFalcon9Block5 FromSLC-4E,VandenbergSFB🇺🇸 🕙Launch time December24th, 13:11UTC🆕 🌍Mission information TypeGovernment/TopSecret OrbitPolarOrbit 🚀Vehicle information CoreB1075.8 (8thflight♻️) LandingLZ-4(RTLS) ℹ️ SARah 2 & 3 are two passive reflector antenna radar satellites built by OHB-System, based on the reflector-antenna technology of SAR-Lupe. They are part of the three satellite constellation being built for the German government as a follow-up to the SAR-Lupe radar sat constellation. #Launch

Hashtags

SpaceX

@SpaceX · Post #10036 · 18.12.2023 г., 18:02

🚀Next launchStarlinkGroup6-34 RocketFalcon9Block5 FromSLC-40,CapeCanaveral🇺🇸 🕙Launch time December19th,04:01UTC 🆕 🌍Mission information TypeCommunications OrbitLowEarthOrbit 🚀Vehicle information CoreB1081.3(3rdflight♻️) LandingASOG(ASDS🌊) ℹ️ A batch of satellites for the Starlink mega-constellation. #Launch

Hashtags

SpaceX

@SpaceX · Post #10030 · 12.12.2023 г., 01:30

🚀Next launchStarlinkGroup6-34 RocketFalcon9Block5 FromSLC-40,CapeCanaveral🇺🇸 🕙Launch time December 13th, 04:05 UTC🆕 🌍Mission information TypeCommunications OrbitLowEarthOrbit 🚀Vehicle information CoreB1081.3(3rdflight♻️) LandingASOG(ASDS🌊) ℹ️ A batch of satellites for the Starlink mega-constellation #Launch

Hashtags

SpaceX

@SpaceX · Post #10023 · 10.12.2023 г., 00:02

🚀Upcoming launchOTV-7(X-37B)(USSF-52) RocketFalconHeavy FromLC-39A,KennedySpaceCenter🇺🇸 🕙Launch time December 13th, 01:14 UTC🆕 🌍Mission information TypeGovernment/TopSecret OrbitUnknown 🚀Vehicle information CoreB1084.1(1stflight🌟) ExpendableLastflight🌠 Boosters B1064.5(♻️x4) (RTLS: LZ-1) B1065.5(♻️x4) (RTLS: LZ-2) ℹ️ It is the seventh flight of the 📷X-37B program. United States Air Force Orbital Test Vehicle is built by Boeing. #Launch

Hashtags

SpaceX

@SpaceX · Post #10021 · 06.12.2023 г., 10:01

🚀Next launchStarlinkGroup6-33 RocketFalcon9Block5 FromSLC-40,CapeCanaveral🇺🇸 🕙Launch time December7th,04:01UTC 🌍Mission information TypeCommunications OrbitLowEarthOrbit 🚀Vehicle information CoreB1077.9(9thflight♻️) LandingJRTI(ASDS🌊) ℹ️ A batch of 23 satellites for the Starlink mega-constellation. #Launch

Hashtags

SpaceX

@SpaceX · Post #10011 · 02.12.2023 г., 20:30

🚀Next launchStarlinkGroup6-31 RocketFalcon9Block5 FromSLC-40,CapeCanaveral🇺🇸 🕙Launch time December3rd,04:00UTC 🌍Mission information TypeCommunications OrbitLowEarthOrbit 🚀Vehicle information CoreB1078.6(6thflight♻️) LandingASOG(ASDS🌊) ℹ️ A batch of satellites for the Starlink mega-constellation #Launch

Hashtags

SpaceX

@SpaceX · Post #9997 · 01.12.2023 г., 00:10

🚀Next launch425ProjectFlight1andothers RocketFalcon9Block5 FromSLC-4E,VandenbergSFB🇺🇸 🕙Launch time December1st,18:19 UTC 🆕 🌍Mission information TypeGovernment/TopSecret OrbitSun-SynchronousOrbit 🚀Vehicle information CoreB1061.17(17thflight♻) LandingLZ-4(RTLS) ℹ️ Note: Name of payload is provisional. First launch of an ultimately 5 reconnaissance satellites for the South Korean Defense Acquisition Program Administration (DAPA), with 1 satellite featuring an electro-optical infrared (EO/IR) telescope. #Launch

Hashtags

123•••67
ПретходнаСтраница 1 од 7Следна