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

Резултати

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

Пребарај: #durban

当前筛选 #durban清除筛选

🐬 uShaka Marine World — a themed park opened in 2004 in Durban, KwaZulu-Natal Province. 🏄‍♂️ It is one of the largest entertainment complexes in South Africa, known for its exciting mix of marine adventures and active recreation. 🐠 🎥 Video: https://t.me/rusbig5/7760 #SouthAfrica#Durban#uShakaMarineWorld#TravelSouthAfrica#ExploreAfrica#AdventureTime

🇿🇦 ЮАР готовится к Рождеству 🎄 Вот так выглядит Дурбан — третий по величине город страны: праздничные огни, океанский бриз и летнее настроение ✨🌴 #Рождество#НовыйГод#ЮАР#Дурбан _______________ 🇿🇦South Africa is getting ready for Christmas 🎄 This is what Durban, the country’s third-largest city, looks like — festive lights, ocean vibes, and a true summer Christmas ✨🌴 #Christmas#NewYear#SouthAfrica#Durban

🏇 Dick Francis (1920–2010) was a British steeplechase jockey (over 350 wins) and the author of 43 crime novels. 📖 The book Smokescreen (1972) and its film adaptation is a detective story set in South Africa. 🎬 Plot: a popular British actor flies to South Africa to find out why an elderly lady’s horses are performing so poorly. But he soon discovers that an ill-wisher is out to get him. 🏇 The novel features detailed accounts of horse races in Durban and thrilling scenes in Kruger National Park, immersing readers in the atmosphere of African adventure. #DickFrancis#Literature#Books#CrimeFiction#SouthAfrica#Kruger#Durban

🍛Two Iconic South African Curries 🇿🇦 Two of the most famous curries in South African cuisine represent the two port cities — Cape Town on the west coast and Durban on the east. ⚓️ Even their names reflect their origins: 🌶Cape Malay Curry Powder refers to Cape Town’s Malay community, 🔥Durban Curry Masala — to Durban’s Indian community. The Cape curry is slightly sweeter and milder, while the Durban curry is hotter and more vibrant thanks to the addition of Kashmiri red chili. 🌶 Source: https://t.me/africamother/800 #SouthAfrica#Food#Cuisine#Cooking#CapeTown#Durban#Spices#Curry

The only revolving restaurant in the Southern Hemisphere is in Durban!🇿🇦 The Roma Revolving Restaurant, opened in 1973, is famous not only for its 360° panoramic views of the city but also for its excellent Italian cuisine. 🇮🇹 🍽 It’s located on the 32nd floor of the iconic John Ross House — and we’ll tell you more about this landmark in an upcoming post! 🎥Video (01:53) #Durban#SouthAfrica#RomaRevolving#Restaurants#Architecture#ItalianFood#TravelSouthAfrica#CityViews

🚩Сегодня, 8 июня 2025, ультрамарафон Comrades стартовал в ЮАР в 08:30 по Екатеринбургу (в 06:30 по Москве) и продлится 12 часов. На фото — команда марафонцев из Екатеринбурга, которую поддерживает Уральский горнопромышленный холдинг. Чтобы прочувствовать атмосферу, посмотрите видео! _______________ 🚩 Today’s the day! On June 8, 2025, the Comrades ultramarathon began in South Africa at 8:30 AM Yekaterinburg time (that’s 6:30 Moscow time), and runners have up to 12 hours to finish. Featured is the Yekaterinburg team, supported by the Ural Mining Holding (UMH). Click to watch videos to get the feel of the event! #sport#marathon#Comrades#Durban#Pietermaritzburg#ЮАР#спорт#марафон#Комрадс

🏙The John Ross House in Durban is a 33-storey skyscraper on the iconic Victoria Embankment. Named after John Ross (real name: Charles Rawden Maclean), who at just 15 years old walked 600 km (370 mi) from Port Natal to Delagoa Bay and back — to bring medicine and supplies to the crew of a shipwrecked vessel. It happened in1825. ⛵️ 🗿 A statue of him stands outside the building. 🍽 At the top of the tower is the Roma Revolving Restaurant, offering panoramic views of Durban. 🏢 The building stands 109 meters (358 ft) tall and was renovated in 2009. Today, it serves both residential and commercial purposes. #Durban#SouthAfrica#Architecture#History#JohnRoss#Landmarks#VictoriaEmbankment#Skyscrapers#RomaRestaurant#Africa

🌴Victoria Embankment in Durban is one of the city’s most iconic waterfront areas — both a major transport route and a symbol of urban identity. 🌆 📍 Along the Embankment you’ll find: 🔹 the famous John Ross House with the Roma Revolving Restaurant 🔹 Durban’s city hall and court buildings 🔹 the historic yacht basin 🔹 monuments, greenery, and sweeping views of the bay 🚶‍♀️ It’s a perfect place for walks, photos, and taking in the rhythm of Durban’s harbor life — where colonial history meets modern African energy. 📹 Video #Durban#VictoriaEmbankment#SouthAfrica#Cityscape#Waterfront#History#UrbanAfrica#TravelSouthAfrica#Architecture#JohnRossHouse#ExploreDurban