Apr-12-2017, 06:53 PM
(Apr-12-2017, 08:02 AM)buran Wrote: @ankit - there is nothing pythonic in thisNot only is it not Pythonic, it's inefficient. The whole point of a dictionary is that it's runtime is constant, but these comprehensions are linear both in time and space.dict['rest'] if len([dict[i] for i in dict if i==n] )==0 else [dict[i] for i in dict if i==n][0]