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

Резултати

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

Пребарај: #positivity

当前筛选 #positivity清除筛选
Quiet World 🍁

@QuietWorld · Post #6627 · 02.10.2019 г., 03:53

It's an absolutely naive to say or think that humans are perpetually happy. Even the most positive person will meet his own dark side. Everyone has a shadow; toxic positivity is the recipe to create thick, dense shadow – because you must always wear the mask of happiness to hide other negative emotions and kick them into unconsciousness until it rots and fester into a monster that will come to the surface when you least expect it. Remember that positivity is not about pretending and not about happiness – it's a mindset; it's about assessing the situation, accepting and understanding your feelings and looking to see if there's anything you can do to make the most of the situation. 🤗 Source: Einzelganger & Positively Present #positivity#selfreminder @quietworld🍃

Quiet World 🍁

@QuietWorld · Post #7241 · 29.03.2020 г., 08:12

Today, Tomorrow or Yesterday? You can't avoid conflicts or problems. In fact, they're ESSENTIAL parts of life. Live today. If you worry about what may go wrong in the future, it might not even happen anyway 🤷🏻‍♀. If you keep on thinking about the past, there's no way to bring you back to the past🙍🏻‍♀. It's okay to look into the future to plan, but not okay to simply worry. It's okay to look back in the past and reflect, but it's not okay to stay stucked in the past. Live. Today. 😊 #life#reminder#positivity @quietworld🍃

Quiet World 🍁

@QuietWorld · Post #6626 · 02.10.2019 г., 03:53

"Positive vibes only 🌸" - oh really? good luck with that! I've been using the word positivity and shared lots of positivity quotes – little that I know that the word 'positivity' can mean differently to different people. So, if you haven't heard it yet, let me introduce you to Toxic Positivity – in which I've also been guilty of at times too🥺 Toxic positivity encourages ignoring negative emotions, but true positivity is about accepting all emotions and doing whatever is possible to work through them, understand them and garner more self-awareness. Toxic positivity presents itself as something anyone can do at any time, but positivity is actually a mindset that doesn't often come easily & must be worked at for most people - IT'S A SKILL. In short, toxic positivity is an attempt to force happiness by rejecting any form of undesirable aspect of an event - but be aware that rejecting either good or bad is similar to rejecting 50% of the universe, because the world isn't good vibes only, it's just vibes. I hope these provide you with a clear understanding of what is toxic positivity and what's true positivity is - and in case you need more clarity, I'd post a few more quotes related in my next posts. 😉 Source: Positively Present & Einzelganger #positivity#afterthoughts#selfreminder @quietworld🍃

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