r/learnpython • u/AutoModerator • 23d ago
Ask Anything Monday - Weekly Thread
Welcome to another /r/learnPython weekly "Ask Anything* Monday" thread
Here you can ask all the questions that you wanted to ask but didn't feel like making a new thread.
* It's primarily intended for simple questions but as long as it's about python it's allowed.
If you have any suggestions or questions about this thread use the message the moderators button in the sidebar.
Rules:
Don't downvote stuff - instead explain what's wrong with the comment, if it's against the rules "report" it and it will be dealt with.
Don't post stuff that doesn't have absolutely anything to do with python.
Don't make fun of someone for not knowing something, insult anyone etc - this will result in an immediate ban.
That's it.
1
u/burqa8-8 22d ago
Do you realy remember the difference between lists, tuples, dictionaries and sets or when you do something with them you look up somewhere to to remind yourself the diffrence
1
u/lakseol 22d ago
With a bit of experience using lists, tuples, dictionaries and sets you very soon have the differences, weaknesses and strengths of each object type memorized. It's like anything else, you remember anything you constantly use. So to directly answer your question, yes, you really do remember the differences between all those data structures. That doesn't always mean you automatically use the best data structure every time you start a problem, but as you work toward a solution, and as you learn more about the problem, you can decide to change a particular data structure if necessary to get a better solution. That's the programmer's life.
1
u/POGtastic itertools evangelist 22d ago
Yes, I remember the differences. I've been doing this for a long time. Keep looking things up and keep practicing until it becomes second-nature.
1
u/Boybay_Garid 22d ago
for heavy CPU-bound work that needs some shared state, is multiprocessing with shared memory still the go-to in the standard library, or are subinterpreters actually practical to use now?
1
u/Far_Yogurtcloset9465 20d ago
Hi everyone! I am a self-taught developer who codes entirely on a smartphone, and I’ve been building a Python project called arpspecter.py. It’s a modular, fully type-hinted ARP/NDP network tool designed strictly for lab testing and pentesting environments using Scapy and Linux firewall manipulation (iptables). I’ve focused heavily on exception handling and automated state restoration (cleanup) to ensure network stability. Since I code on my phone, I don't have a traditional IDE setup, so I would highly appreciate it if someone with more experience in network security or Python backend development could review it. I am looking for feedback on: • Code architecture and performance improvements. • Better or more modern ways to handle Scapy packet streams. • Asynchronous improvements or threading optimizations. Here is the code: https://gist.github.com/davisanches8736/dd9535507ed227bb2788857cf9e48e92
PS: English is not my first language, so please bear with me! If this post goes against any community guidelines, please let me know and I will take it down immediately. Thanks!
1
u/ApprehensiveProof761 23d ago
difference b/w print and return
use of class and __init__ and self