About list(DEVICE_DICT.keys()) in other scripts #59
Unanswered
BilldarBagdar
asked this question in
Q&A
Replies: 1 comment 1 reply
-
no, it actually doesn't make a difference (currently), but if ALL other scripts (checked 10 or so) use it like that, I am hesitant, because as my python skills are still lacking, my approach is to see what others are doing and copy that (basically learning like a child). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
if
list(DEVICE_DICT.keys())
is justDEVICE_DICT.keys()
, does it cause you problems in Py3 or whatever?The return type of keys() is already a List object. So wrapping with list() seems redundant to me. But I also don't notice any functional difference one way or the other, so if it does make a difference on your side, it needs to stay. But if the only reason is because you see it that way in other scripts, I say remove it, it's redundant.
Similarly with the
for_display_only=False
parameter. It's redundant to usefor_display_only=False
20 times when we call the method instead of once (as an optional parameter) when we declare the method. If we ever need to usefor_display_only=True
it will be way easier to spot the "non default behavior" where the method is called with the non-default parameter valuefor_display_only=True
in the one or few non-default places where it is called that way.Beta Was this translation helpful? Give feedback.
All reactions