4 ms·
Agreed. This is not the sort of code you want to be dealing with in a few years time. Also, I seldom find that string based dicts are what I need. One of the b
by aidos 10y ago
Agreed. This is not the sort of code you want to be dealing with in a few years time.
Also, I seldom find that string based dicts are what I need. One of the best things about Python is being able to use virtually anything as a key.
- user5994461 10y ago> One of the best things about Python is being able to use virtually anything as a key. I find that to be the thing one of the worst thing ever made into a programming language. You are facing a program/API/library and you can have absolutely no clue of what it will give or expect without extensive reverse engineering.
- xapata 10y agoI find that's more a problem of bad design and bad names, rather than flexible types.
- dragonwriter 10y ago> You are facing a program/API/library and you can have absolutely no clue of what it will give or expect without extensive reverse engineering. Or reading the docs.
- aidos 10y agoWait, you choose what to put in the dict. I like being able to map from, say, db objects to internal representations. Why wouldn't you want that?!
- dllthomas 10y agoThe concern is facing something that expects a map, and not knowing how to correctly populate it.
- aidos 10y agoTime has taught me to prefer lists / flat structures as arguments to functions (and in most other storage and transfer contexts). Besides, either you're passing in entities that conform to the api, or you're not. Nothing about arbitrary keys in dicts changes that.