Бывает начинающие в процессе обучения создают файлы с именем модуля который они изучают. В результате на тестовых запусках ничего не работает😱
Всё потому, что появилась коллизия имён. Например, изучаете вы модуль datetime, и создаёте с таким именем файл (ну логично же😄) прямо в рабочей директории.
Потом, при попытке импортировать datetime модуль, из-за приоритета импорта будет импортирован файл из рабочий директории а не оригинальная библиотека. Ведь имя файла это суть имя модуля!
А знаете ли вы, что не все стандартные модули можно так перезаписать? Коллизии имён не подвержены builtin модули. Они всегда стоят на первом месте в приоритете импорта, поэтому их нельзя заменить.
Полный список таких модулей можно посмотреть в списке sys.builtin_module_names.
То есть, вы сломаете весь Python если назовёте свой модуль os или site, но если назовёте time или gc то ничего страшного не случится)))
Тем не менее, никогда не называйте модули уже занятыми именами!!!⚠️
Я всегда рекомендую всем своим файлам делать именной префикс из 2-3 символов. Например я называю свои проекты так:
pw_project_name
pw_ui_tools.py
pw_something/main.py
Либо под ситуацию
tst_scriptname.py
(не "test" чтобы не подхватывал pytest)
dbg_script.py
maya_ui.py
hou_menu_tools.py
И искать проще, и коллизий нет.
#tricks#basic
🕊November 7: The Woman Who Said “No” to Apartheid
🇿🇦🗓 November 7 marks the birthday of Helen Suzman (née Gavronsky; 1917–2009) — a South African activist and politician who bravely stood against apartheid.
She was the only member of Parliament to consistently and unequivocally oppose all apartheid legislation.
Suzman played a crucial role in improving prison conditions for members of the banned African National Congress (ANC), including Nelson Mandela, and she used her parliamentary privilege to bypass government censorship and share reports on the worst abuses of apartheid.
She was nominated twice for the Nobel Peace Prize. 🕊
💬Quotes by Helen Suzman:
• “I was the only one who said ‘no’ to apartheid, but that was no reason to keep quiet.”
• “It is not my questions that embarrass South Africa—it is your answers.”
(Addressed to the apartheid government during her time in Parliament.)
• “The test of civilization is the way that it cares for its helpless members.”
📸 Photo: Wikipedia
#SouthAfrica#History#HumanRights#AntiApartheid#Mandela
🗓 June 18 – Thabo Mbeki turns 83
On this day in 1942, Thabo Mvuyelwa Mbeki, the second President of South Africa (1999–2008) after Nelson Mandela, was born. As a young man, he studied in the Soviet Union and played a key role in the anti-apartheid movement.
🎓 Mbeki has long emphasized the power of education in transforming Africa. Here are some of his most compelling quotes:
💬 “We must prioritize education and invest in our young people. They are the future leaders and the driving force of our continent's development.”
💬 “Education is the key to unlocking the potential of our people. It’s the tool that will help us overcome challenges and build a brighter future.”
💬 “Education is not just about acquiring knowledge. It’s about developing critical thinking and a lifelong thirst for learning.”
#Education#Mbeki#Birthday#SouthAfrica#Mandela
🗓🎉October 7 — Birthday of Archbishop Desmond Tutu (1931–2021)
A fearless anti-apartheid activist, theologian, and the first Black South African Anglican bishop, Desmond Tutu received the Nobel Peace Prize in 1984 for his unwavering fight for justice and equality. ✝️✨
🕊🇿🇦 After South Africa’s first democratic elections in 1994, President Nelson Mandela appointed him to chair the Truth and Reconciliation Commission (TRC) — a crucial step toward national healing after decades of apartheid.
💬Quotes by Desmond Tutu:
• “If you want peace, you don’t talk to your friends. You talk to your enemies.”
• “Hope is being able to see that there is light despite all of the darkness.”
• “Without forgiveness, there is no future.”
• “If you are neutral in situations of injustice, you have chosen the side of the oppressor.”
• “Children are a wonderful gift. They have an extraordinary capacity to see into the heart of things and to expose sham and humbug for what they are.”
#DesmondTutu#SouthAfrica#History#NobelPeacePrize#HumanRights#Mandela
🇿🇦 The Office of the Honorary Consul of South Africa met with Tatyana Mohamed — a Yekaterinburg native who has lived in South Africa for more than 30 years. 🌍✨
📸 Her husband is a renowned photographer who used to work with Nelson Mandela.
During the meeting, we shared insights about the activities of the Honorary Consul, Sergey Mazurkevich, and discussed opportunities for future cooperation and potential joint projects. 🤝
#SouthAfrica#Yekaterinburg#Diplomacy#Cooperation#Culture#Mandela#Photography#HonoraryConsul
NELSON MANDELA STATUE IN PRETORIA
🕊 The nine-meter statue of Nelson Mandela stands on the grounds of the Union Buildings in Pretoria.
🗓 It was officially unveiled on December 16, 2013, one day after the end of South Africa’s 10-day national mourning period, which followed Mandela’s passing on 5 December.
📍 The unveiling took place on Reconciliation Day, a symbolic moment marking a new chapter in the nation’s journey.
With outstretched arms, the statue represents unity, reconciliation, and the spirit of Ubuntu — values Mandela championed throughout his life.
More on Ubuntu in an upcoming post.
#SouthAfrica#Mandela#Pretoria#UnionBuildings#Ubuntu#MandelaLegacy#ReconciliationDay#History#Architecture