Подразумеваемые неймспейсы или неявные пакеты.
Этот функционал добавлен в 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
#writing
@ieltsstrategies
🖌📕Make the most of your Writing test:
@ieltsstrategies
• analyse each task properly and spend some time making notes
• highlight or underline key words in the tasks to make sure that you focus on what you have to do
• plan your answers
• use paragraphs clearly; put one idea in each paragraph
• do not repeat ideas using different words
• do not copy whole sentences from the question – you will receive no marks for this
• keep to the topic; do not write about unrelated subjects
• manage your time; remember, Task 2 is worth twice as much as Task 1
• spend approximately 20 minutes on Task 1 and approximately 40 minutes on Task 2
• you must write your answers in full; answers written in note form or in bullet points will lose marks
@ieltsstrategies
• pay attention to spelling, grammar and punctuation; you will lose marks for mistakes
• avoid informal language
• do not memorise model answers; examiners are trained to recognise them and your test will be invalid
• spend several minutes re-reading and correcting your answers
@ieltsstrategies
#writing
✅ Writing time
🔰 Task 1 (Pie charts 🧇 )
✌️ 2-qism
🧇 Pie charts yozish uchun bu ajoyib qo'llanma o'z ichiga turli foydali mashq va so'zlarni olgan bo'lib foydali bo'ladi degan umiddaman.
♻️@cambridgeIELTSbooks
#writing
✅ Writing time
🔰 Task 1
☺️Sizlarga qanday qilib Task 1 savolini Paraphrase qilishni va shu asosida introduction yozishni o'rgataman. Agar foydali deb hisoblasangiz,ulashing.
♻️@cambridgeIELTSbooks
#writing
✅ Writing time
🔰 Task 1 (Line graph 📉📈)
✌️2-qism
📈 Line graph yozish uchun bu ajoyib qo'llanma o'z ichiga turli foydali mashq va so'zlardan iborat bo'lib foydali bo'ladi degan umiddaman.
♻️@cambridgeIELTSbooks
#writing
Qani endi mana bu task 1 uchun tayyorlagan kichik qo’llanmani ilingchi. Ha evaziga izohlarda “ rahmat “ deb yozib qoldirish “tekin” aytib qo’yay😁. Oldingi postda qoldiribsizlarku, shundan ilhomlanib “tishimni kavagida” saqlayotganlarimni ham ulashyapman aytib qo’yay🤪.
👍@cambridgeieltsbooks
Ayrimlar hatto like bosish pullik deb o’ylaydimi deymanda “reaction”lar kamligini ko’rib ba’zan.
✅Writing time
This book is written by a certified professional IELTS instructor who scored Band 9.0 in Academic IELTS.
It provides useful tips and academic word lists for IELTS writing Task 1.
Sharing is caring🔥✊
#writing
✅Channel: @cambridgeIELTSbooks
✅Writing time
▶️TYPES OF IELTS WRITING TASK-2 QUESTIONS
1️⃣Discuss both views and give your opinion?
2️⃣Do you think the advantages outweigh disadvantages?
3️⃣What are the advantages and disadvantages?
4️⃣Is it a positive or a negative development?
5️⃣What are the problems/reasons/causes for this? What would you suggest as a solution?
6️⃣What are the reasons/causes? And how it affects? /what are the effects? /consequences?
7️⃣What are the reasons for this change? Is it a positive or a negative development?
8️⃣To what extent do you agree or disagree?
9️⃣How far do you agree or disagree?
1️⃣0️⃣Do you agree or disagree?
❗️Please note that serial numbers 8, 9 & 10 have the same essay structure
#writing
♻️Sharing is caring🤓
✅Channel: @cambridgeIELTSbooks
✅IELTS WRITING
▶️In this mini-book you will know types of writing task 1 and academic vocabulary to use.
#writing
🤓Kanalga qo'shiling 👇
⭐️@cambridgeIELTSbooks
YouTube|Instagram|Telegram
3 本写作书籍
https://x.com/lennysan/status/1918418517063512088
Lenny Rachitsky 最近推荐了对他写作帮助最大的 3 本书籍,On Writing Well、Nobody wants to read your sh*t、Several short sentences about writing。
这种可以直接 Deep Research 过一遍,感兴趣的可以选择性阅读,前面我们也分享了很多写作合集,参考、精进。
相关链接
关于如何写作丨主题分享
#writing