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

Резултати

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

Пребарај: #theparallel

当前筛选 #theparallel清除筛选

🎙Long waited testnet for Parallel is ON🔥🔥🔥 🎮TESTNET FOUNDATION GAME: PARAGON CRAFTING🎮 ➧REGISTER NOW! ⚖️Requirement: Have at least 1000 PRL in Wallet BUY NOW: https://poocoin.app/tokens/0xd07e82440a395f3f3551b42da9210cd1ef4f8b24 👉Registration Form: https://prl.onl/testnetform ⏰Registration Open: Jan 6, 2022 - Jan 10, 2022 ⏰Valid Wallet Scan: 13:00 UTC on Jan 10, 2022 #TheParallel#Metaverse#PRL

🔥🔥🔥ARE YOU READY? JUST 20 minutes LEFT There is nothing more excited than waiting for the Super Listing Event from The Parallel at the moment. Do not miss us! Set your alarm at 13:00 UTC right now, Parallese. Events on the Super Listing Event you should pay attention!! 👉 SQuizz Game on Livestream 🎁 20,000 PRL for the 200 people have the highest score Step 1: Log in to your MetaMask wallet address at theparallel.io Step 2: Follow the Super Listing event and wait for the questions to appear randomly throughout event time (15 questions in total) Step 3: Answer the questions at theparallel.io 👉 Share NOW - Earn NOW - 🎁 20,000 PRL for 1,000 fastest Parallese sharing and $1000 for 1 luckiest one Step 1: Share the Livestream on Facebook or Twitter with the hashtag #TheParallel#Super_Listing_Event#Metaverse#PRL Step 2: Tag 5 of your friends in the comment section Step 3: Enter the link of your sharing post and your wallet address at: https://t.me/prlsharenowbot 📌 Listing time: Revealed in the Livestream. You must watch the full live stream to find out 🔐 PRL smart contract address: 0xd07e82440A395f3F3551b42dA9210CD1Ef4f8B24 1️⃣ Install BEP-20 Wallet (Metamask) 2️⃣ Adding PRL smart contract before Listing will help shorten transaction time and increase fair competition with bots. 3️⃣ Prepare BUSD, BNB in your wallet and approve BUSD in PancakeSwap 📎 Find out details at: https://prl.onl/3FqvCrh

🎙The Parallel - An Infinite Metaverse announcement🔥🔥 The Parallel - An Infinite Metaverse@theparallel_io Feb 23👑 Check Out Rune Hunter: Ascension! First game launched by The Parallel Metaverse 👉Read the game guide! We want your first impressions and thoughts! 👉Checkout Ascension NOW:https://prl.onl/3LU3xfv ⏰ ETA: Mid March Testnet #Gamefi#playtoearn$PRL #PRL#theparallel#Ascension