TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #197 · 4 јан.

Подразумеваемые неймспейсы или неявные пакеты. Этот функционал добавлен в Python 3.3 Что он означает? Ранее, до 3.3 пакетами считались лишь директории, в которых есть файл __init__.py. Этот файл одновременно являлся свидетельством того, что директория это Python-пакет, и служил "телом" этого пакета. То есть местом, где можно написать код, как это делается внутри модуля. Этот код исполняется в момент импорта пакета, так что его принято называть "код инициализации пакета". Начиная с версии 3.3 Любая директория считается пакетом и Python будет пытаться использовать любую директорию для импорта. Конечно, не любую в файловой системе, а только те что находятся в sys.path. Это значит, что теперь __init__.py нужно делать только если: 🔸 вам требуется создать код инициализации пакета 🔸 нужна совместимость со старыми версиями Python На мой взгляд это немного упрощает разработку, делает её чище, но с другой стороны убивает некоторую однозначность происходящего. Например, я создал репозиторий со своей библиотекой и рядом положил код примеров или тестов. repo_name/ my_library/ __init__.py main.py examples/ exam1.py exam2.py В этом репозитории пакетом является только my_library, остальные директории это не пакеты, это просто дополнительный код в файлах. Директория examples не добавлена в sys.path, в ней нет рабочих модулей. Но если она лежит рядом с my_library, то Python вполне сможет импортнуть из неё модули, так как посчитает что examples это валидный пакет. Конечно, пример несколько надуманный. Никто не будет добавлять корень репозитория в sys.path. Но, я думаю, суть ясна. Иногда директория это просто директория а не пакет! #basic#pep

Hashtags

Резултати

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

Пребарај: #cop26

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

@reutersworldchannel · Post #149241 · 12.10.2021 г., 01:24

Explained: Carbon pricing and COP26 This year’s COP26 climate meeting aims to secure far bolder action from the nearly 200 countries that signed the 2015 Paris Agreement. Global carbon pricing is one of the mechanisms they hope will achieve that #News#Reuters#COP26 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 #149553 · 19.10.2021 г., 09:47

Designer Vivienne Westwood shares her 'Letter to Earth' British fashion designer Vivienne Westwood and Nigerian author Ben Okri read out their 'Letters to the Earth' as part of a campaign urging action against climate change in the run-up to the U.N. #COP26 summit. #News#Reuters#ClimateChange 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 #149550 · 19.10.2021 г., 02:04

Explained: Key things to watch for at COP26 As public pressure grows for action to limit climate change, world leaders from nearly 200 countries will convene in Glasgow, Scotland, at the end of October for the COP26 conference. Here are the key climate issues that need resolution. #COP26#News#Reuters#ClimateChange 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 #149403 · 15.10.2021 г., 13:02

Xi will not attend COP26 in person, report says Chinese President Xi Jinping will not attend the COP26 climate summit in person, British Prime Minister Boris Johnson has been told, The Times newspaper reported. #News#Reuters#XiJinping#COP26 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 #149220 · 11.10.2021 г., 15:47

LIVE: The WHO launches its COP26 report The World Health Organization launches its COP26 report "The Health Argument for Climate Action" along with an open letter from 45 million health professionals worldwide calling for an ambitious outcome at the upcoming event in Glasgow. #COP26#COP26Glasgow#environment#Reuters#Live#News 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 #149263 · 12.10.2021 г., 18:16

COP26 president Alok Sharm says leaders 'must step up' The G20 group of leading economies must come forward with more ambitious 2030 climate action plans before the United Nations COP26 conference, its president, Alok Sharma said. #COP26#ClimateChange#environment#AlokSharma#News#Reuters 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 #149316 · 13.10.2021 г., 17:27

LIVE: IMF's Georgieva, COP26's Sharma talk about climate change ahead of COP26 IMF Managing Director Kristalina Georgieva and COP26 President and British Minister Alok Sharma discuss climate change in the run up to the U.N. Climate Change Conference during the World Bank/IMF annual meetings. #Reuters#News#Live#IMF#COP26#environment#climate ➖@reutersworldchannel➖

Reuters: World

@reutersworldchannel · Post #149258 · 12.10.2021 г., 16:27

Thunberg expects 'meaningless' pledges at COP26 For activist Greta Thunberg, success at the upcoming U.N. climate conference would be possible if world leaders honestly admit that their action is not living up to their words. #GretaThunberg#COP26#UNClimateConference#ClimateChange#News#Reuters 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 #149236 · 11.10.2021 г., 22:21

Prince Charles talks climate change Ahead of the U.N. Climate Change Conference COP26, Prince Charles shares Greta Thunberg's concerns that world leaders 'just talk' about climate change and are not doing enough to prevent its catastrophic impact. #News#Reuters#PrinceCharles#ClimateChange#Environment#GlobalWarming#COP26 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➖