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

Резултати

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

Пребарај: #btogether

当前筛选 #btogether清除筛选
HDB

@SingaporeHDB · Post #3175 · 17.04.2026 г., 10:54

Take our quiz to test your HDB knowledge ⬇️ Are you ready to #BTOgether? Let’s see how much you know about buying a BTO flat! P.S. No stress, this is an open book quiz 😉 You can check out these BTO-related guides on MyNiceHome first: 💰CPF Housing Grants for HDB Flat Buyers 🔍HDB Flat Types and Classification 🏠How to Buy a BTO Flat

Hashtags

HDB

@SingaporeHDB · Post #2136 · 11.01.2024 г., 10:02

How will your 2024 look like? If you’re planning to apply for a BTO flat in 2024, you can look forward to 3 sales launches this year – with the first sales launch happening in February! Apply for your HFE letter by 15 January, if you’re thinking of to participating in the upcoming February sales launch. Get ready to #BTOgether🏠 Find out more at https://homes.hdb.gov.sg.

Hashtags

HDB

@SingaporeHDB · Post #2111 · 08.12.2023 г., 03:01

Planning to purchase a new home at the December sales launch? Check out which flats you can consider according to your monthly household income! Work out your housing budget with HDB’s online calculators at https://homes.hdb.gov.sg#BTOgether

Hashtags

HDB

@SingaporeHDB · Post #2099 · 07.12.2023 г., 10:09

Looking for a 4-room flat this sales launch? Here’s what the sums could look like. Head over to https://homes.hdb.gov.sg to find out more about the grants and schemes available for first-timer families, and use our financial calculators to plan your purchase. #BTOgether

Hashtags

HDB

@SingaporeHDB · Post #2088 · 07.12.2023 г., 03:31

Looking for a 3-room flat this sales launch? Here’s what the sums could look like. Head over to https://homes.hdb.gov.sg to find out more about the grants and schemes available for first-timer families, and use our financial calculators to plan your purchase. #BTOgether

Hashtags

HDB

@SingaporeHDB · Post #2081 · 06.12.2023 г., 02:00

Check out the prices of each flat type on offer this sales launch! Work out your housing budget with HDB’s online calculators at https://homes.hdb.gov.sg#BTOgether

Hashtags

HDB

@SingaporeHDB · Post #2072 · 05.12.2023 г., 07:20

JUST IN: 6,057 flats on offer at the December BTO sales launch! Find out more about the projects at Bedok, Bishan, Bukit Merah, Bukit Panjang, Jurong West, Queenstown, and Woodlands. About 50% of the BTO flats launched this sales launch have a wait time of 4 years or less – for those who are looking to move into their flats sooner, the flats at Sin Ming Residences have wait time of about 2 years and 8 months, while Jurong Arcadia has a wait time of about 3 years and 1 month. Get your HFE letter ready, and apply for your new home at https://homes.hdb.gov.sg by 11 December. #BTOgether

Hashtags

HDB

@SingaporeHDB · Post #2042 · 11.11.2023 г., 03:01

It’s 11/11 and we did not forget you 💖 In the second half of 2024, singles can apply for 2-room Flexi flats across all HDB projects islandwide, not just in non-mature estates! We will also launch up to 14,000 2-room Flexi BTO flats from 2024 to 2026 to meet demand. #BTOgether

Hashtags

HDB

@SingaporeHDB · Post #1929 · 24.09.2023 г., 04:01

Ready to #BTOgether at the upcoming sales launch? It’s as easy as 🔤! To plan your budget, use our online calculators at https://homes.hdb.gov.sg. Simply input the info from your approved HFE letter, and you will be able to work out your flat budget. More about the new First-Timer (Parents & Married Couples) category and priority schemes.

Hashtags

HDB

@SingaporeHDB · Post #1843 · 07.07.2023 г., 04:00

Swiftie or not, remember to apply for HFE before you #BTOgether. Read the guide on how to apply for an HFE letter.

Hashtags

HDB

@SingaporeHDB · Post #1328 · 02.08.2022 г., 02:00

🏠 Gearing up to #BTOgether? 💰 Learn how to assess your financial fitness, plan for a home purchase, and plan ahead for your life as a couple at the Institute of Financial Literacy’s free financial planning workshop!

Hashtags

12
ПретходнаСтраница 1 од 2Следна