General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Dr Gamma D
Indently
comments
Comments by "Dr Gamma D" (@DrDeuteron) on "Python's 5 Worst Features" video.
Yes, David Hilbert said if he were awoken in 100 years, his first question would be has the Riemann Hypothesis been proved what version of python is in beta?
23
I learned something today.
6
forget about speed, just reducing cyclomatic complexity is a win.
5
he agreed, his only 0xDEADBEEF was the name in the for/while context. I do love the construction, and have no problem with the name...for me it's "BREAK or ELSE"....
2
@ego-lay_atman-bay >>>import array been there since wayback. Will tell devs exactly what your plan is. Obv. if you're dong scientific computations, you're gonna numpy, but the above is pure python.
2
@valerielboss yes, so a_copy[0] *= 2 will also change a[0]. One way to test is evaluate the boolean: >>>a is a_copy False which compares the id()'s. So in his 1st example: >>>a_copy == a, a_copy[1] is a[1] (True, True) while: >>>a_copy is a False. (but I didn't test those in an interpreter, but all pyhtonistas should try it out to learn it).
2
@casualchou because it violates a fundamental principle of Guido: never mix statements and expressions...or something like that. that's why python will never have the UV light of bug attractors, --, ++, avoiding code like: if ++n < m-- then: return ((++n) + (m++) * ((--n)*(--n) + (m++)*(++m))**(++n / m--)
2
@noteverymonday *argparse
2
the "readline" module allows fancier input, but I have never used it, so idk if it has what you want.
2
it does run the else block if the loop had no iterations. It's useful if say you count successes: for count, item in enumerate(container, start=1): break else: count = 0 print(f"Found {count} items) w/o the else block, you get a NameError, and to prevent that you would need to predefine count=0, which is U G L Y, and unpythonic.
1
not iterable, but mutable. You can use "tuple" safely.
1
if someone does star import from a module, that module better have a dunder all module constant.
1
this is good, because lists aren't arrays, and you should not be using them as arrays. Use an array, otherwise you are violating POLA.
1
@pharoah327 omg, that is the most unpythonic post possible.
1
@pharoah327 what I mean is that you're coming to a python channel and bringing treif ideas of which we have already purified ourselves. It is unpythonic to: 1) care what any other language does. 2) care about "under-the-hood". Python is a language meant to be read by Man. That it runs on a computer is secondary.
1
@ShunyValdez shallow copies are: >>>func = functools,.partial(filter, 's'.__ne__) >>>"".join(*func(''Spain'.casefold())) 'pain' is safer. Why index?
1
Python's worst feature is definitive: that 3x and 2x needed to EXIST. Just a whole code base jacked.
1
lambda's are for in-line anonymous use, if you use them elsewhere, you can get into trouble. Like: >>>scale = lambda x: A*x >>>A = 10 >>>y1 = scale(4) >>>A =10030 >>>y2 = scale(4) they are unbound and will change meaning when let out on their own. Just keep them where they belong.
1
@atrus3823 curry with functools.partial
1
You can divide success and failure sans-loop with: loop = itertools.dropwhile(not_found, sequence): try: answer = next(loop) except StopIteration [failure block here] else: [success block here] finally: print('but idk')
1
I'm pretty sure this was a set, not a list.,,but he failed to annotate it.
1