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

Резултати

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

Пребарај: #electricvehicles

当前筛选 #electricvehicles清除筛选
Reuters: World

@reutersworldchannel · Post #149309 · 13.10.2021 г., 15:22

Tesla may push Volkswagen to speed EV shift, job cuts Competition from Tesla is pushing Volkswagen to think about speeding up its transition to electric vehicles. #News#Reuters#Volkswagen#electricvehicles Subscribe: http://smarturl.it/reuterssubscribe Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled. Get the latest news on: http://reuters.com/ Follow Reuters on Facebook: https://www.facebook.com/Reuters Follow Reuters on Twitter: https://twitter.com/Reuters Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en ➖@reutersworldchannel➖

Reuters: World

@reutersworldchannel · Post #149509 · 18.10.2021 г., 13:16

Foxconn shows off its electronic vehicles With three electric vehicle prototypes, Taiwan's Foxconn underscores its ambitious plans to diversify away from its role of building consumer electronics for Apple. #News#Reuters#Foxconn#EV#electricvehicles Subscribe: http://smarturl.it/reuterssubscribe Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled. Get the latest news on: http://reuters.com/ Follow Reuters on Facebook: https://www.facebook.com/Reuters Follow Reuters on Twitter: https://twitter.com/Reuters Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en ➖@reutersworldchannel➖

Venture Village Wall 🦄

@venturevillagewall · Post #3378 · 18.12.2024 г., 12:08

VOICE Secures $589.55K Funding VOICE announces a funding round of $589.55K aimed at transforming the logistics industry through advanced electric vehicle solutions, promoting sustainability for the future. For more details, visit their website. #Funding#VOICE#Logistics#ElectricVehicles#Sustainability#InnovativeSolutions

Auto Life

@revheadcrypto · Post #410 · 30.08.2024 г., 16:41

🚗✨Tesla Model Y Facelift Coming in 2025!🌟 Exciting news for Tesla fans! The refreshed Model Y is set to hit the market, with deliveries starting as early as Q1. By the end of the year, a new three-row seating version will roll off the Shanghai assembly line, ready to take on Europe and beyond! 🌍🛠️ Get ready for an upgraded driving experience! 🎉 #Tesla#ModelY#Facelift2025#ElectricVehicles#Innovation#Auto🚀🔋

Reuters: World

@reutersworldchannel · Post #149287 · 13.10.2021 г., 00:17

Energy from bogs: using peat to make batteries Scientists at Estonia's Tartu University say they have found a way to use peat in sodium-ion batteries, which reduces the overall cost, although the technology is still in its infancy. #News#Reuters#SodiumIonBatteries#Estonia#Peat#Lithium#ElectricVehicles Subscribe: http://smarturl.it/reuterssubscribe Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled. Get the latest news on: http://reuters.com/ Follow Reuters on Facebook: https://www.facebook.com/Reuters Follow Reuters on Twitter: https://twitter.com/Reuters Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en ➖@reutersworldchannel➖

Auto Life

@revheadcrypto · Post #249 · 06.08.2024 г., 07:24

🚗✨Record Sales for Chinese Auto Brands in Europe!🇪🇺 In June, Chinese automakers achieved a remarkable milestone by selling 23,000 new electric vehicles in Europe, capturing over 11% of the European EV market—a record high for a single month! 🌍🔋 Leading the charge was the brand MG, with an impressive 13,500 units sold. 📈👏 This surge in sales is likely driven by the upcoming increase in import tariffs on vehicles from China within the EU. #ChineseCars#ElectricVehicles#EVMarket#RecordSales#MG#SustainableDriving#Auto

Auto Life

@revheadcrypto · Post #52 · 06.07.2024 г., 12:18

📸Exciting news from the automotive world! The first electric MINI JCW E will be revealed on 11 July at the 'Festival of Speed' in Goodwood. 🤫 Stay tuned for more details on the powertrain, although with options like a 184bhp motor with a 40.7kWh battery and a 218bhp motor with a 54.2kWh battery in the electric MINI Cooper SE, we can expect the JCW version to pack even more power. 📆 While the MINI JCW E PROtotype will be showcased in action at the event, the full details will be unveiled later this year. MINI also hints that the JCW lineup will feature both electric and gasoline models. #ElectricVehicles#MINIJCW#GoodwoodFOS#AutomotiveInnovation#MINICooperSE#FutureOfMobility#Auto

Auto Life

@revheadcrypto · Post #438 · 04.09.2024 г., 19:33

🌍⚡️Norway Sets World Record for Electric Car Sales!🚗💨 In August, electric vehicles captured an astonishing 94.3% of the market! That's 10,500 units sold! 🎉 Leading the charge is the Tesla Model S, accounting for 18.8% of sales! 🥇 Following closely are the Hyundai Kona and Nissan Leaf! 🥈🥉 Norway continues to pave the way for a sustainable future! 🌱✨ #ElectricVehicles#Norway#Sustainability#Tesla#HyundaiKona#NissanLeaf#Auto

Auto Life

@revheadcrypto · Post #213 · 01.08.2024 г., 07:59

Audi has officially unveiled the new generation A6! Now, this index belongs to electric vehicles — a liftback and an estate version. 🚘 The exterior of the new models is almost entirely copied from the namesake concepts, while the interior is inspired by the Q6 e-tron crossover. 🚢 The base version will be the rear-wheel drive A6 e-tron performance with a single motor producing 367 hp. For the S6, there will be two motors delivering 550 hp and accelerating from 0 to 100 km/h in just 3.9 seconds, with a top speed of 240 km/h. 🔋 In both cases, a 100 kWh battery is provided, allowing the single-motor versions to travel up to 756 km, while the all-wheel drive versions can reach up to 675 km. ℹ️ Pre-orders will start in September, with prices starting at €75,600 for the standard version and €99,500 for the S6. #Audi#A6#ElectricVehicles#ETRON#CarLaunch#LuxuryCars#Innovation#S6#Auto

IELTS|Newspapers & Magazines|English

@emagzinewspars · Post #9427 · 27.10.2025 г., 08:19

#The_Car_and_Driver🇺🇸📕[PDF]⬇️ #November2025 #December2025 #Monthly_Magazines For learning, for free(dom). @backupofmagazines This issue celebrates an #AmericanDream on wheels: the 1250-hp Czinger 21C, a 3D-printed hypercar redefining #Innovation and #Performance. From Ford’s GTD squaring off with Porsche’s 911 GT3 RS to Cadillac’s $360K electric Celestiq, this issue dives into the new frontiers of #EV evolution and engineering design. Reports explore China’s automaker boom, the presidential motorcade’s airborne future, and Honda’s latest #Tech breakthrough. With head-turning tests of Tesla’s Cybertruck, Mercedes-AMG, and Peugeot classics, this edition speeds through the future of mobility and craftsmanship. #Cars#Design#ElectricVehicles#Hypercar#CarCulture