this post was submitted on 06 Feb 2025
21 points (100.0% liked)
CSCareerQuestions
1047 readers
43 users here now
A community to ask questions about the tech industry!
Rules/Guidelines
- Follow the programming.dev site rules
- Please only post questions here, not articles to avoid the discussion being about the article instead of the question
Related Communities
- [email protected] - a general programming community
- [email protected] - general question community
- [email protected] - for questions targeted towards experienced developers
Credits
Icon base by Skoll under CC BY 3.0 with modifications to add a gradient
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
The way Python is implemented, almost all objects in the language are dicts and can be accessed with the
__dict__
dunder. Which has some useful applications when transforming data.But in the case, the interviewer was likely looking for knowledge that one is structured and maintained by indicies vs defined keys. And that searching through a dictionary is O[1] vs list that is O[N] but are inverted for deletion. So if you are doing a lot of inserts and seaeching, use a dict, but if you have something that has tons of deletions, use a list. However, there's tricks to improve the deletion speed downside that can be used with a slight memory tradeoff.