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

Резултати

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

Пребарај: #sgbudget2024

当前筛选 #sgbudget2024清除筛选
gov.sg

@Govsg · Post #2574 · 22.11.2024 г., 07:24

📢 The Weekly Wrap – 22 November 2024 1️⃣ PSA: #SGBudget2024 December Benefits Are On The Way! 📢📢📢 We are nearing the end of the year - check out what you’re eligible for under #SGBudget2024 in December – Assurance Package Cash, MediSave Bonus, Retirement Savings Bonus! 🔗 Check your eligibility at govbenefits.gov.sg 2️⃣PAU-liament Round-up! 🎥🎥🎥 Want to stay informed on the latest discussions in Parliament but short on time? We’ve got the solution! Catch up on the latest updates with the PAU-liament round-up! https://www.instagram.com/reel/DCnoWa_NZef/?igsh=MXV2OXpldnY5Z3hqbw== 3️⃣The Landlady Singer Returns! 🎶🎶🎶 Get ready to be entertained! ‘The Landlady Singer Returns’ brings laughter, music and heart to you every Tuesday at 8pm on Channel 8. You can also catch the first 4 episodes at go.gov.sg/thelandladysingerreturns

gov.sg

@Govsg · Post #2560 · 15.11.2024 г., 06:31

#SGBudget2024 More support is coming in December 2024 to help with your daily living expenses and healthcare needs. Find out more: govbenefits.gov.sg.

gov.sg

@Govsg · Post #2483 · 01.10.2024 г., 12:30

#SGBudget2024 Look forward to enhanced U-Save and S&CC rebates for eligible households this October! Find out more in govbenefits.gov.sg.

gov.sg

@Govsg · Post #2381 · 13.08.2024 г., 10:00

📢#SGBudget2024 Special cash payment of $200 to $400 for eligible Singaporeans coming your way in September! 🔗 Find out more: govbenefits.gov.sg

gov.sg

@Govsg · Post #1971 · 21.02.2024 г., 11:46

The CPF Special Account will be closed for members aged 55 and above in early 2025. What can you do to continue earning higher long-term interest rate? Find out ⬆️#SGBudget2024 Infographic: MOM with CPF Board

NEA Singapore

@NEASingapore · Post #778 · 04.03.2024 г., 11:34

#SGBudget2024 Enjoy energy savings and lower utility bills! Claim your vouchers from 15 Apr 2024. As part of the enhanced Climate-Friendly Households Programme, the vouchers can be used to purchase 10 types of energy- and water-efficient household products. More info at go.gov.sg/climatevouchers

NEA Singapore

@NEASingapore · Post #777 · 04.03.2024 г., 11:31

#SGBudget2024 To support businesses to build competencies in waste management, we have partnered training providers to introduce the course. This can help to improve resource efficiency, lower costs, and enhance corporate social responsibility. More info at go.gov.sg/zero-waste-manager-course

NEA Singapore

@NEASingapore · Post #776 · 04.03.2024 г., 11:11

#SGBudget2024 From 1 Jan 2026, paints sold in Singapore intended for application on the interior of buildings will be required to have no formaldehyde. Minimising formaldehyde improves indoor air quality and is part of our ongoing efforts to safeguard public health. More info at www.nea.gov.sg/year-of-public-hygiene

SkillsFutureSG

@skillsfuturesg · Post #545 · 16.02.2024 г., 08:20

📢 Exciting news from #SGBudget2024: Together with MOE, SkillsFuture Singapore is stepping up support for mid-career Singaporeans with the new SkillsFuture Level-Up Programme 🚀 Discover how you can reskill and upskill to stay relevant in this changing economy. For more information, check out go.gov.sg/Budget24-SFLPTG🔍

gov.sg

@Govsg · Post #1969 · 16.02.2024 г., 12:24

#ICYMI DPM and Finance Minister Lawrence Wong delivered the #SGBudget2024 which introduced new measures to safeguard Singapore’s peace and security. This includes establishing a new National Cybersecurity Command Centre and Future Energy Fund. Find out more ⬆️ or visit www.singaporebudget.gov.sg. Infographics: MOF

gov.sg

@Govsg · Post #1963 · 16.02.2024 г., 12:14

#ICYMI#SGBudget2024The Government will strengthen support for seniors and their retirement needs. This includes boosting the Mahjulah Package, raising the CPF Enhanced Retirement Sum and enhancing the Age Well SG programme. Full details ⬆️ or visit www.singaporebudget.gov.sg. Infographics: MOF

ПретходнаСтраница 1 од 3Следна