[tor-dev] Relay Dashboard Code Review

Damian Johnson atagar at torproject.org
Wed Aug 5 18:12:36 UTC 2015


>>   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)

Thanks meejah for the additional feedback! For this last one as I
understand it WEBSOCKETS contains values that are empty lists, and he
wants this function to return None when that's the case. That's why I
did it the way above.


More information about the tor-dev mailing list