Многие из тех кто активно работал с Python2 несколько удивлены, почему в Python3 удобная функция reload() переехала из builtin в imp а потом и в importlib?
Ну было же удобно! А теперь лишний импорт😖
Дело в том, что начиная с Python3.3 функция reload() переписана на Python вместо Cи.
Что это нам даёт?
🔸 Такой код проще поддерживать и развивать
🔸 Python код легче читать, изучать и понимать.
Сравните это ➡️ и это ➡️.
🔸 Как результат пункта 2, проще писать свои расширения импорта. Например, пользовательский импортёр с какой-либо хитрой логикой по аналогии с импортом из zip архивов.
А есть ли у этого решения недостатки? Да, они всегда есть.
🔹 Так как это не builtin функция, её следует импортнуть перед использованием
🔹 Скорость замедлилась примерно на 5%. Очевидно, что это совершенно не критично. К тому же от версии к версии логика импорта будет оптимизироваться и ускоряться.
В самом начале файла importlib/__init__.py мы видим такой импорт:
import _imp # Just the builtin component, NOT the full Python module
То есть часть функционала по прежнему написана на Си, но достаточно низкоуровневая.
#basic
🏚Demolition of illegal buildings has begun in Bingin
📰 Protests have been unsuccessful. Mass demolition of illegal buildings has begun on Bingin Beach: more than forty warungs, boutique hotels, and surf schools are to be dismantled.
📍 The authorities call it the restoration of state land, while local entrepreneurs fear losing their only source of income. Among the establishments that are to disappear from the coastal map are the varungs Didi's, Kelly's, and Ombak.
#beaches#Uluwatu#realestate@BaliNews
🏄♀️Rip Curl Cup kicked off in Uluwatu
📍 One of the most prestigious competitions in world surfing has started at the Balinese spot Padang Padang.
🌊 On which of the days in August the awards will be drawn, no one knows. Organizers, judges and athletes will be waiting for the best waves, the so-called "pipes", to show all that they know how to do for a month.
🏆 This year the format of the Rip Curl Cup has been updated. The organizers decided to follow the ideas of gender equality and agreed to hold separate competitions for women at the same time with men. The last time this happened in Bali was 21 years ago. President of Rip Curl Indonesia James Hendy explained that the decision to create a women's division this year was made after the success of Canadian surfer Erin Brooks, who competed with men at the last Rip Curl Cup last year and reached the final, in which at first even led.
🖥 You can watch the broadcast of the championship itself, as well as find out the date of the championship at the link.
🎉 The main party of Rip Curl Cup-2024 will start at 17:00 on August 30 and will continue until midnight.
@BaliNews
#events#beaches#beaches#sports#Uluwatu
🛣Details about the construction of a district road in Bukit
District authorities are set to solve the road issue in Uluwatu by laying a new district road.
Construction of the first section from Siligita village to Sawangan in Nusa Dua district has already started.
The original idea was to extend the toll road, which now runs from the airport to Nusa Dua, all the way to Uluwatu.
Right now, traffic on the main road jl. Uluwatu is difficult because it is both a hub of commerce and the main thoroughfare of the area, used by everyone from locals to construction vehicles and tour buses.
The land acquisition budget for 2024 will be $16 million, with the next one already promised to increase to $19 million.
According to an insider in Bali's land office, all consideration of new housing development in the green zone on Bukit is now halted just in time for the land acquisition for the new roads.
@BaliNews
#roads#roads#authorities#Bukit#Uluwatu#NusaDua