Python can make a dictionary immutable without copying data!
Usually, to protect configurations and the overall state, a copy of the dictionary is made, which creates unnecessary memory allocations.
MappingProxyType creates a read-only proxy over a dictionary โ writing through it becomes impossible, but the data is not copied.
At the same time, the proxy remains alive: if the original dictionary changes, the changes will automatically be reflected in the read-only view.
This is especially useful for configurations, internal APIs, overall state, and data protection within libraries.
๐ฅ MappingProxyType allows you to provide a read-only view of the dictionary without copying and without the risk of mutation through the returned object.
#Python #Immutable #DataProtection #MappingProxyType #ProgrammingTips #NoCopy
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
Usually, to protect configurations and the overall state, a copy of the dictionary is made, which creates unnecessary memory allocations.
safe = dict(config)
MappingProxyType creates a read-only proxy over a dictionary โ writing through it becomes impossible, but the data is not copied.
readonly["debug"] = True # TypeError
At the same time, the proxy remains alive: if the original dictionary changes, the changes will automatically be reflected in the read-only view.
config["debug"] = True
This is especially useful for configurations, internal APIs, overall state, and data protection within libraries.
def get_settings():
return MappingProxyType(settings)
๐ฅ MappingProxyType allows you to provide a read-only view of the dictionary without copying and without the risk of mutation through the returned object.
#Python #Immutable #DataProtection #MappingProxyType #ProgrammingTips #NoCopy
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
Telegram
AI PYTHON ๐
Youโve been invited to add the folder โAI PYTHON ๐โ, which includes 14 chats.
โค2
The ternary operator in Python looks appealing, but it's easy to overdo it with it ::
Just because the code can be compressed into one line, doesn't mean it's a good idea for readability.
When the logic starts to branch out (3+ conditions) โ the usual if-elif-else becomes much more understandable and easier to maintain.
It's better to leave the ternary operator for simple and short cases:
โข compact expressions in comprehensions
โข small lambda functions
โข simple one-line returns
๐ก #Python #Coding #Programming #Developer #SoftwareEngineering #CodeQuality
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
'A' if s>=90 else 'B' if s>=80 else 'C' if s>=70 else 'F'
Just because the code can be compressed into one line, doesn't mean it's a good idea for readability.
When the logic starts to branch out (3+ conditions) โ the usual if-elif-else becomes much more understandable and easier to maintain.
It's better to leave the ternary operator for simple and short cases:
โข compact expressions in comprehensions
โข small lambda functions
โข simple one-line returns
๐ก #Python #Coding #Programming #Developer #SoftwareEngineering #CodeQuality
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
โค1
Forwarded from Machine Learning with Python
๐ SPOTO Mid-Year Sale โ Grab Your IT Certification Success Kit!
๐ฅ Whether you're prepping for #Python, #AI, #Cisco, #PMI, #Fortinet, #AWS, #Azure, #Excel, #Comptia, #ITIL, #Cloud or any other hot certification โ SPOTO has your back with real exam dumps and hands-on training!
โ Free Resources:
ใปFree Python, Excel, Cyber Security, Cisco, SQL, ITIL, PMP, AWS courses: https://bit.ly/4alTSfk
ใปIT Certs E-book: https://bit.ly/49ub0zq
ใปIT Exams Skill Test: https://bit.ly/4dVPapB
ใปFree AI material and support tools: https://bit.ly/4elzcpl
ใปFree Cloud Study Guide: https://bit.ly/4u7sdG0
๐ Join SPOTO Mid-Year Lucky Draw:
๐ฑ iPhone 17 ๐ Free Order
๐ Amazon Gift $100 ๐PMP/ AWS/ CCNA Course
๐ Enter the Draw Now โ https://bit.ly/4uN3lVt
๐ Join Our IT Learning Community for free resources & support:
https://chat.whatsapp.com/FQOG04r9xSiIa2ElhaNUJU
๐ฌ Want exam help? Chat with an admin now:
https://wa.link/knicza
โฐ Mid-Year Deal Ends Soon โ Don't Miss Out!
๐ฅ Whether you're prepping for #Python, #AI, #Cisco, #PMI, #Fortinet, #AWS, #Azure, #Excel, #Comptia, #ITIL, #Cloud or any other hot certification โ SPOTO has your back with real exam dumps and hands-on training!
โ Free Resources:
ใปFree Python, Excel, Cyber Security, Cisco, SQL, ITIL, PMP, AWS courses: https://bit.ly/4alTSfk
ใปIT Certs E-book: https://bit.ly/49ub0zq
ใปIT Exams Skill Test: https://bit.ly/4dVPapB
ใปFree AI material and support tools: https://bit.ly/4elzcpl
ใปFree Cloud Study Guide: https://bit.ly/4u7sdG0
๐ Join SPOTO Mid-Year Lucky Draw:
๐ฑ iPhone 17 ๐ Free Order
๐ Amazon Gift $100 ๐PMP/ AWS/ CCNA Course
๐ Enter the Draw Now โ https://bit.ly/4uN3lVt
๐ Join Our IT Learning Community for free resources & support:
https://chat.whatsapp.com/FQOG04r9xSiIa2ElhaNUJU
๐ฌ Want exam help? Chat with an admin now:
https://wa.link/knicza
โฐ Mid-Year Deal Ends Soon โ Don't Miss Out!
โค1
๐ Reminder on Python set โ set methods!
For example,
In the picture โ the main methods and operations for working with set: addition, removal, union, intersection, difference, and set checks.
Save it to not lose it!
#Python #SetMethods #Coding #DataScience #Programming #HelloEncyclo
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
For example,
add() adds an element to the set, update() combines several elements, and intersection() helps quickly find common values between data sets.In the picture โ the main methods and operations for working with set: addition, removal, union, intersection, difference, and set checks.
Save it to not lose it!
#Python #SetMethods #Coding #DataScience #Programming #HelloEncyclo
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
10 GitHub Repositories for Web Development in Python ๐
Explore the best Python web development repositories for building APIs, full-stack web apps, dashboards, machine learning demos, internal tools, and interactive Python-based user interfaces. ๐ฅ
https://www.kdnuggets.com/10-github-repositories-for-web-development-in-python
#Python #WebDevelopment #GitHub #Coding #API #Tech
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
Explore the best Python web development repositories for building APIs, full-stack web apps, dashboards, machine learning demos, internal tools, and interactive Python-based user interfaces. ๐ฅ
https://www.kdnuggets.com/10-github-repositories-for-web-development-in-python
#Python #WebDevelopment #GitHub #Coding #API #Tech
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
Guessing numbers
This project for beginners in Python is a fun game that generates a random number (within a certain range) that the user must guess after receiving hints.
For each incorrect guess, the user receives additional hints, but at the cost of reducing their overall score.
๐ก๐๐ฎ #Python #Coding #Beginners #Game #Learning #Tech
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
This project for beginners in Python is a fun game that generates a random number (within a certain range) that the user must guess after receiving hints.
For each incorrect guess, the user receives additional hints, but at the cost of reducing their overall score.
๐ก๐๐ฎ #Python #Coding #Beginners #Game #Learning #Tech
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
โค2
Forwarded from Machine Learning with Python
I often see people say that it's impossible to enter the IT field without expensive courses.
However, there's a huge amount of high-quality materials available for free:
๐ Computer Science
https://github.com/ossu/computer-science
๐ Data Structures & Algorithms
https://github.com/jwasham/coding-interview-university
๐ System Design
https://github.com/donnemartin/system-design-primer
๐ Web Development
https://github.com/TheOdinProject/curriculum
๐ Frontend / Backend / DevOps / Cloud
https://github.com/kamranahmedse/developer-roadmap
๐ Data Engineering
https://github.com/DataTalksClub/data-engineering-zoomcamp
๐ Machine Learning & AI
https://github.com/microsoft/ML-For-Beginners
๐ MLOps
https://github.com/DataTalksClub/mlops-zoomcamp
๐ Cybersecurity
https://github.com/OWASP/CheatSheetSeries
๐ Linux
https://github.com/trimstray/the-book-of-secret-knowledge
๐ Free Programming Books
https://github.com/EbookFoundation/free-programming-books
If you have internet and a bit of free time, you can learn computer science, algorithms, system design, DevOps, clouds, security, and machine learning for free.
The problem now isn't a lack of information. The problem is regularly opening these repositories and actually working on them.
#FreeLearning #ITCareer #CodingResources #TechEducation #OpenSource #DevCommunity
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
However, there's a huge amount of high-quality materials available for free:
๐ Computer Science
https://github.com/ossu/computer-science
๐ Data Structures & Algorithms
https://github.com/jwasham/coding-interview-university
๐ System Design
https://github.com/donnemartin/system-design-primer
๐ Web Development
https://github.com/TheOdinProject/curriculum
๐ Frontend / Backend / DevOps / Cloud
https://github.com/kamranahmedse/developer-roadmap
๐ Data Engineering
https://github.com/DataTalksClub/data-engineering-zoomcamp
๐ Machine Learning & AI
https://github.com/microsoft/ML-For-Beginners
๐ MLOps
https://github.com/DataTalksClub/mlops-zoomcamp
๐ Cybersecurity
https://github.com/OWASP/CheatSheetSeries
๐ Linux
https://github.com/trimstray/the-book-of-secret-knowledge
๐ Free Programming Books
https://github.com/EbookFoundation/free-programming-books
If you have internet and a bit of free time, you can learn computer science, algorithms, system design, DevOps, clouds, security, and machine learning for free.
The problem now isn't a lack of information. The problem is regularly opening these repositories and actually working on them.
#FreeLearning #ITCareer #CodingResources #TechEducation #OpenSource #DevCommunity
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
GitHub
GitHub - ossu/computer-science: ๐ Path to a free self-taught education in Computer Science!
๐ Path to a free self-taught education in Computer Science! - ossu/computer-science
โค1
How to create an object from a dictionary with dot access โ without classes and dataclasses?
When you're working with JSON, configurations, or APIs, constant access via dict['key'] clutters the code and worsens readability:
SimpleNamespace gives the same result, but with dot access:
In this case, the object remains dynamic, and you can add fields:
However, the keys must be valid attribute names, and this only works for flat dictionaries (nesting is not converted).
๐ฅConvenient for prototyping, testing, and simple data.
#Python #DataStructures #SimpleNamespace #CodingTips #DevTools #Programming
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
When you're working with JSON, configurations, or APIs, constant access via dict['key'] clutters the code and worsens readability:
data = {"host": "localhost", "port": 5432}
data["host"]SimpleNamespace gives the same result, but with dot access:
cfg = SimpleNamespace(**data)
print(cfg.host)
In this case, the object remains dynamic, and you can add fields:
cfg.debug = True
However, the keys must be valid attribute names, and this only works for flat dictionaries (nesting is not converted).
๐ฅConvenient for prototyping, testing, and simple data.
#Python #DataStructures #SimpleNamespace #CodingTips #DevTools #Programming
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
โค3
What are lambda functions in Python?
Lambda functions โ are anonymous functions, which are created using the lambda keyword. They can accept any number of arguments, but contain only one expression, the result of which is automatically returned.
They are most often used for short operations, for example during sorting, filtering or data processing.
#Python #LambdaFunctions #DataScience #Coding #Programming #TechTips
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
Lambda functions โ are anonymous functions, which are created using the lambda keyword. They can accept any number of arguments, but contain only one expression, the result of which is automatically returned.
They are most often used for short operations, for example during sorting, filtering or data processing.
# Example:
sorted_data = sorted(data, key=lambda x: x[1])
filtered_data = list(filter(lambda x: x > 0, numbers))
#Python #LambdaFunctions #DataScience #Coding #Programming #TechTips
โจ Join Best TG Channels https://xn--r1a.website/addlist/0f6vfFbEMdAwODBk
โญ๏ธ Join Our WhatsApp Channel https://whatsapp.com/channel/0029VaC7Weq29753hpcggW2A
๐ Level up your AI & Data Science skills with HelloEncyclo โ a growing all-in-one platform featuring hands-on courses in LLMs, Deep Learning, MLOps, Data Engineering, and more.
โ 13 courses live + 40+ coming soon
๐ฏ One access, lifetime updates
๐ Use code: PRESALE-BOOK-WAVE-2GFG
๐ https://helloencyclo.com/?ref=HUSSEINSHEIKHO
Telegram
AI PYTHON ๐
Youโve been invited to add the folder โAI PYTHON ๐โ, which includes 14 chats.
โค3๐ฅ1