I have some code with a variable named "angle". However in the loop I mistakenly wrote "angla".
My question is, how might I make VS code warn me about this? Some IDEs, like PyCharm, warn me of the mistake.
...
for line in open("data.txt", "r"):
...
angle_a = atan2(Vya, Vxa)
angle_b = atan2(Vyb, Vxb)
while t <= 10:
Pa, Va_mag, angle_a, Va = motion(
Pa, Va_mag, angle_a, Va)
Pb, Vb_mag, angle_b, Vb = motion(
Pb, Vb_mag, angle_b, Vb)
if collision_test(Pa, Pb) == True:
Va, Vb = after_collision_velocity(Va, Vb, Pa, Pb)
Va_mag = vec_magnitude(Va)
Vb_mag = vec_magnitude(Vb)
angla_a = atan2(Va[1], Va[0]) # here is the mistake
angle_b = atan2(Vb[1], Vb[0])
t += dt
...
Is there any way VS code could give me an error when something like this happens? Any helpful extensions, spell-checkers, AI-IntelliSense, etc? (Python-specific)
angla_ais a typo ofangle_aand not a new object as your code indicates? Consider this - should VS code also warn you when you introduceangle_clike "did you meanangle_b?" IMO unfortunately this is one of those scenarios you just need to be careful, because it is a valid syntax, just creating a new object.angel_a. It's just a spelling check, which there are plenty spell checker extension on the VS Code extension market. But if you actually wanted to check for objects being referenced correctly that's a different story.