General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Dr Gamma D
Indently
comments
Comments by "Dr Gamma D" (@DrDeuteron) on "Is THIS Python's MOST Underrated Operator? (Walrus Operator)" video.
I agree. I remember reading there is no n++ operator b/c Guido never mixes expressions and assignments, but I guess that is passé. Moreover, which order is the dict construction evaluated? I guess left to right, but that is non-pythonic code imho. Also: what if you assign to word more than once in the dict constructor? Sounds buggy af.
5
I agree. I use it in if statements where I need the value on some branches but not all..esp if I only need it to throw errors with messages. I mean if I need the value for clean execution, I'm happy to devote a line of code.
1
and I have been doing py since 2002, and the arrow is new to me. As far as Im concerned it's for babies addicted to their IDEs to tell them how to write code. I mean I usually go with new python stuff, but this seems down right unpythonic. Java dev hand holding.
1
@IManu96I the whole package. I mean when I see: name: str = "Monty" that is not pythonic at all.
1
I don't think I like type hints.
1
that is nice
1
well that explains it.
1
I reject 2 function calls, and would do: print(user_input, 'up' if Len(user_input) > 5 else 'down') no, I would have:\ RESPONSE = {True: 'up', False: 'down'} defined in the appropriate namespace and have 1 execution line: print(ui, RESPONSE[len(ui) > 5]) because I prefer static complexity over dynamic complexity...within reason.
1
you should pass x to do_things()....just to show that you actually need it.
1
@epicanthus idk. I make all function pure, so this use case I would avoid. Maybe in a method.
1
I prefer collections.defaultdict, which is different...but usually more appropriate. just won't throw a KeyError.
1