Damian Johnson <ata...@torproject.org> writes: > Very minor thing, but little odd using dict() that way.
Personally, I don't find it that odd ;) and prefer it since braces can define sets or dicts in Python, and using dict(...) makes it a little more explicit. BTW, your counter-example is a syntax error; you need to quote the keys, which is another reason I prefer the kwarg-style dict definition... > Generally it's good idea to both only catch the exception types you need, and > include the exception in the message so there's some hint for > troubleshooting. Yes, you should really never have a bare "except:" to avoid catching things like MemoryError or KeyboardInterrupt yourself. > def get_websockets(ws_type = None): > websocket = WEBSOCKETS.get(ws_type, []) > return websocket if websocket else None How about just: def get_websockets(ws_type=None): return WEBSOCKETS.get(ws_type, None) -- meejah _______________________________________________ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev