I have a simple piece of code that works, but I'd like to know if I can make it more Pythonic by using the dict.get() method.
chunk_size = 100000
if "chunk_size" in self.conf["source_config"]:
chunk_size = self.conf["source_config"]["chunk_size"]
This overwrites the value for variable chunk_size with self.conf["source_config"]["chunk_size"], but only if the key chunk_size is present in said configuration.
How can I make this more Pythonic?
This is one possible way you might or might not have thought about;
This might be a little more pythonic than a full if clause?