@QuietWorld · Post #6887 · 10.11.2019 г., 10:39
#life#positivity @quietworld🍃
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #303 · 27 дек.
Наверняка вы замечали, что в Python есть удобная функция для получения переменной окружения os.getenv(NAME) И её "сестра" для создания или изменения переменных окружения os.putenv(NAME, VALUE) Но почему-то putenv() не работает как должно. Энвайромент не обновляется! os.putenv('MYVAR', '1') print(os.getenv('MYVAR')) ... и ничего 😴 Почему так? На самом деле энвайромент обновляется, но это значение не добавляется в словарь os.environ. Откройте исходник функции os.getenv(). Это просто шорткат для os.environ.get() В то время как putenv() это built-in С-функция. Словарь os.environ (или точней класс из MutableMapping) создаётся из энвайромента в момент инициализации. Функция putenv() самостоятельно его не изменяет. В тоже время, когда вы создаёте или изменяете ключ в os.environ, автоматически вызывается putenv() в методе __setitem__(). То есть, технически putenv() всё делает верно, но в os.environ это не отражается. Можно проверить так: >>> os.putenv('MYVAR', '123') >>> os.system('python -c "import os;print(os.getenv(\'MYVAR\'))"') 123 Я объявил переменную в текущем процессе и вызвал дочерний процесс, который её унаследовал и получил в составе os.environ. Аналогично при удалении переменной вызывается еще одна built-in функция unsetenv(), удаляющая переменную из системы. Итого ▫️ Удобней всего явно обновлять переменные через os.environ ▫️ Есть способ неявно создать/удалить переменную через putenv/unsetenv, что не повлияет на os.environ но изменит энвайромент и передаст изменения сабпроцессам. Но так лучше не делать! ▫️os.environ это просто обертка для built-in функций putenv() и unsetenv(). #basic
Hashtags
Пребарај: #positivity
@QuietWorld · Post #6887 · 10.11.2019 г., 10:39
#life#positivity @quietworld🍃
Hashtags
@QuietWorld · Post #6633 · 03.10.2019 г., 00:00
"Our emotional states are often very complex and we should allow ourselves the freedom to feel multiple things at the same time." – Positively Present – #positivity#quotes @quietworld🍃
Hashtags
@QuietWorld · Post #6632 · 02.10.2019 г., 22:45
"You can be sad, angry, upset, anxious, drained, overwhelmed, unsure or afraid AND STILL BE POSITIVE :) Positively Present #quotes#positivity@quietworld🍃
Hashtags
@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🍃
Hashtags
@QuietWorld · Post #7691 · 23.11.2020 г., 23:00
#positivity#truth@quietworld🍃
Hashtags
@QuietWorld · Post #7607 · 24.09.2020 г., 07:39
#life#reminder#positivity @quietworld🍃
Hashtags
@QuietWorld · Post #7557 · 13.08.2020 г., 10:56
“A lamp that is lit and hidden under a bed would forever beam.” #life#reminder#positivity @quietworld🍃
Hashtags
@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🍃
Hashtags
@QuietWorld · Post #6904 · 14.11.2019 г., 14:55
#positivity#gratitude @quietworld🍃
Hashtags
@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🍃
@QuietWorld · Post #7952 · 27.11.2021 г., 14:36
I'm no perfect person & I know that there's still a lot of things that I need to learn & there's still lots of experience that need to be gained. As long as I accept myself & be gentle to myself as I learn, that is what truly matters. ☺️ #thoughts#life#positivity#attitude @quietworld🍃
@QuietWorld · Post #7099 · 23.12.2019 г., 06:38
🎈Success and failure. We think of them as opposites, but they’re really not. They’re companions—the hero and the sidekick. #success#positivity#motivation @quietworld🍃
Hashtags