If you don't mutate objects that don't belong to you, you'll rarely need deepcopy.
I'm not saying "never use deepcopy" (it certainly CAN be useful), just that every deepcopy call should be questioned.
If you don't mutate objects that don't belong to you, you'll rarely need deepcopy.
I'm not saying "never use deepcopy" (it certainly CAN be useful), just that every deepcopy call should be questioned.
You could make a deep copy instead:
from copy import deepcopy
processed_data = deepcopy(tweet_data)
for tweet in processed_data:
tweet["date"] = datetime.strptime(tweet["date"], "%b %d %Y")
You could make a deep copy instead:
from copy import deepcopy
processed_data = deepcopy(tweet_data)
for tweet in processed_data:
tweet["date"] = datetime.strptime(tweet["date"], "%b %d %Y")
processed_data = [
{**tweet, "date": datetime.strptime(tweet["date"], "%b %d %Y")}
for tweet in tweet_data
]
In Python, we usually prefer making NEW objects over mutating existing ones.
processed_data = [
{**tweet, "date": datetime.strptime(tweet["date"], "%b %d %Y")}
for tweet in tweet_data
]
In Python, we usually prefer making NEW objects over mutating existing ones.
Avoid needless deep copying. 🧵
Often a deepcopy call can be replaced by a comprehension, a slice, or some other operation that makes new objects.
When you copy a list of dictionaries, you get a NEW list pointing to the SAME dictionaries.
#Python #DailyPythonTip
Avoid needless deep copying. 🧵
Often a deepcopy call can be replaced by a comprehension, a slice, or some other operation that makes new objects.
When you copy a list of dictionaries, you get a NEW list pointing to the SAME dictionaries.
#Python #DailyPythonTip
- Solution: memory-graph.com#codeurl=http...
- Explanation: github.com/bterwijn/mem...
The Solution link uses 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: github.com/bterwijn/mem...
to visualize code execution.
#PythonDev #memory_graph #ShallowCopy #DeepCopy
- Solution: memory-graph.com#codeurl=http...
- Explanation: github.com/bterwijn/mem...
The Solution link uses 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: github.com/bterwijn/mem...
to visualize code execution.
#PythonDev #memory_graph #ShallowCopy #DeepCopy
aescripts.com/deepcopy
#aftereffects #aescripts #deepcopy
Stepping back from client work to actually play with mograph again — here’s how this one came together. In-depth tutorials and scripts coming soon, stay tuned 👀
aescripts.com/deepcopy
#aftereffects #aescripts #deepcopy
Stepping back from client work to actually play with mograph again — here’s how this one came together. In-depth tutorials and scripts coming soon, stay tuned 👀
Can you predict the output of this Python code without running it? 🤔
This one tests your understanding of Python’s deepcopy() and object identity.
Think carefully and share your answer in the comments! 👇
www.clcoding.com/2026/08/pyth...
Can you predict the output of this Python code without running it? 🤔
This one tests your understanding of Python’s deepcopy() and object identity.
Think carefully and share your answer in the comments! 👇
www.clcoding.com/2026/08/pyth...
github.com/myclabs/Dee...
github.com/myclabs/Dee...
aescripts.com/deepcopy
#aftereffects #aescripts #deepcopy
Stepping back from client work to actually play with mograph again — here’s how this one came together. In-depth tutorials and scripts coming soon, stay tuned 👀
aescripts.com/deepcopy
#aftereffects #aescripts #deepcopy
Stepping back from client work to actually play with mograph again — here’s how this one came together. In-depth tutorials and scripts coming soon, stay tuned 👀
www.freecodecamp.org/news/how-to-...
www.freecodecamp.org/news/how-to-...
www.freecodecamp.org/news/how-to-...
www.freecodecamp.org/news/how-to-...
Listen to the full episode at realpython.com/podcasts/rpp... or in your preferred podcast client.
Happy Pythoning!
Listen to the full episode at realpython.com/podcasts/rpp... or in your preferred podcast client.
Happy Pythoning!
The newest Cilium contributor is @jonathangrahl
They helped preserve ownerreferences when updating ingresses with a shared load balancer 💪
https://github.com/cilium/cilium/pull/28452/
The newest Cilium contributor is @jonathangrahl
They helped preserve ownerreferences when updating ingresses with a shared load balancer 💪
https://github.com/cilium/cilium/pull/28452/