TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

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

Резултати

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

Пребарај: #psychology

当前筛选 #psychology清除筛选
Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40038 · 08.11.2025 г., 09:48

In what is known as the Dunning-Kruger effect, people who have low skill or knowledge in a certain area tend to overestimate their abilities, while those who are more highly skilled tend to underestimate their abilities. This happens because the metacognitive skills required to accurately assess one's own performance are also the skills necessary to perform well in the first place. @googlefactss#psychology

Hashtags

Journey to Fluency

@fluencyinenglish · Post #6846 · 10.02.2019 г., 05:07

Амин Махдави: #psychology @ieltsstrategies ❇️LIFE A young new mother hurriedly dropped off her toddler at daycare, only able to speak for a short minute before she ran off to catch the train. On that ill-fated day, the train crashed. Struggling for life, a bystander comforted her. “Think about your family,” she said. “About your children& your friends. You are loved.” She did her best to hold on, but the pain was too much. She was gone. While this story made headlines when a New Jersey commuter train crashed into a platform, it’s but one of many other perilous sagas where life is cut too short & our friends or loved ones are taken away due to illnesses, violence, accidents and natural disasters, just to name a few. The point? Life is so precious that rather than allowing the sands of time to slip through our hands, we have to seize the moment. Yet, we have difficulties with enjoying what we have in the present. We often find ourselves longing for something else, never really savoring what we have right now, in this very moment. Often, it takes some calamity or major strife for us to realize the fragility of life, & just how precious we all are in the eyes of someone near and dear to our hearts. It shouldn’t take massive amounts of pain to open our eyes to the beauty of what we have. We tend to allow the miracles that are happening all around us to fall by the wayside as we sit in wallow, immersed in fear, replete with stress & anxiety. It shouldn’t work like that. But we all know that it does. We all take this precious life for granted at one point or another in our lives. Yes, all of us. @ieltsstrategies However, if you’ve landed here, then there’s a reason why you’re reading these words. The simple fact will always remain that no matter what happens— no matter what trials or tribulations you've to dredge through, life will always be precious. We just have to find the good in every moment, no matter how meek or meager it might seem to us, because everything in life is subjective, gleaned upon by the status quo in our minds. @ieltsstrategies The problem with that? We don’t look to what we have. Rather, we’re deluged with a flood of thoughts immersed in what we don’t have. We envy others for enjoying success & the fruits of their labors while we live in a tormented state of pity & regret. It bothers us when people around us succeed. It bothers us that our seemingly small problems seem so big. Today, right now, at this very moment, there are people enduring a tremendous amount of strife. Not just afar in places like Syria or North Korea, but in our very own backyards. When you stop to think about it for a moment, there is an enormous amount of pain and suffering happening everywhere. The sheer enormity of it all can certainly feel overwhelming. However, the plight of others should remind us about the importance of the simple beauties and treasures in our own lives. Instead of looking to the haves, we must look to the have-nots as a reminder of what we do have rather than what we don’t have. We have to get off the Hedonic Treadmill & become more attuned to the preciousness in every moment of time. @ieltsstrategies The fact of the matter remains that we’re here one moment then gone the next. If we spend that infinitesimal amount of time steeped in worry & negative emotions, we’ll never realize the miraculous gift of life that we’ve been given. If you stop to think about the probability of life & our own existence, you’ll realize why every moment needs to be savored & treated like it could be our last. However, all of this is just talk. To the person who’s suffering through the torment of failure or has entirely lost hope in life, these are just words. The words might invoke some emotions, but they’re ultimately overpowered by the burden of thousands of pounds of problems resting like the weight of the world on our shoulders. Yet, no matter what the present situation might be— no matter how many problems might exist — this too shall pass & your faith must remain unwavering. @ieltsstrategies

Hashtags

Quiet World 🍁

@QuietWorld · Post #6447 · 08.05.2019 г., 15:30

Sleep deprivation has the opposite effect on healthy people versus those with depression. If you're healthy and sleep deprived, it can decrease your mood; however, it can improve the mood and cognitive abilities of people with depression. @googlefactss#psychology

Hashtags

Love & Relationship Tips ❤ 💖

@loveandrelationshiptips · Post #874 · 06.03.2023 г., 12:47

Look into someone’s eyes when you get a dissatisfactory answer. Sometimes we don’t like the answer to a question that we receive and sometimes we don’t understand it. Instead of repeating the question or asking another, look into the eyes of the person. This will make the person feel under pressure or cornered, and this will force them to further elaborate their thoughts. #psychology

Hashtags

Love & Relationship Tips ❤ 💖

@loveandrelationshiptips · Post #859 · 24.02.2023 г., 17:57

🦶 Look at someone’s feet before starting a conversation. Is there anything more awkward than starting a conversation with someone who clearly does not want to be talking to you? Fortunately, people tell a whole lot with their body language, including whether or not they’re open to having a conversation. Next time you see the opportunity to strike up a chat, take a quick glance at the other person’s feet. If the other person has turned only their body — not their feet — in your direction, psychology says they are not interesting in talking in that particular moment. #Psychology

Hashtags

Love & Relationship Tips ❤ 💖

@loveandrelationshiptips · Post #858 · 24.02.2023 г., 17:56

🗣 Use people’s first name to form a positive new relationship. When you meet someone new, start right away by referring to them by their first name. Studies have shown that people appreciate when people they’ve just met take the time to learn and remember their name. Taking the time to learn and use the name of a new friend will go a long way in establishing trust and friendship. #Psychology

Hashtags

123•••910
ПретходнаСтраница 1 од 10Следна