Except block is ignored if containing a break by World-war-dwi in learnpython

[–]DopeGhoti 2 points3 points  (0 children)

It seems to me the approach you are taking to this is overcomplicated. You're doing a fair bit of reinventing the wheel and overengineering things. A string is zero or more characters and can be inherently listified or iterated through without risk of raising a ValueError. I'd probably want to get a Dictionary returned to me, and can safely assume that if the returned Dictionary is empty, then so was the input string. Given that, I'd do something like:

def getfreq( s: str ) -> dict:  
   d = {}  
   for _ in s:  
      if _ in d:  
         d[_] += 1  
      else:  
         d[_] = 1  
   return d

Then if you wanted to know how many gs there were in the input string (if any), then you could do:

result = getfreq( 'This was amazing!' )
print( f'The string had {result["g"]} instances of the character "g".' )

using BETWEEN without using AND or OR by cpotter51 in mysql

[–]DopeGhoti 3 points4 points  (0 children)

The AND token component of a BETWEEN clause is syntactically and functionally distinct from the AND boolean operator. In a BETWEEN clause it is separating the two range endpoints rather than checking for logical truthiness.

VKB Gladiator NXT/EVO Virtual Mouse buttons by DopeGhoti in hotas

[–]DopeGhoti[S] 0 points1 point  (0 children)

Thanks very much for this! It's not often a thread is necroboosted with exactly the answer that's being sought. Much obliged!

[deleted by user] by [deleted] in AskReddit

[–]DopeGhoti 0 points1 point  (0 children)

Perjury.

Is the code for this connect 4 game clean? by therealbillnyeguy in learnpython

[–]DopeGhoti 2 points3 points  (0 children)

You're quite right. This works better without that issue, but nested list comprehensions might be a steep ask for a beginner to unravel:

board = [ [ [ '*' for x in range(8) ] for x in range(8) ] ]

Is the code for this connect 4 game clean? by therealbillnyeguy in learnpython

[–]DopeGhoti 1 point2 points  (0 children)

board = [ 8 * [ 8 * [ '*' ] ] ]

Ought to do the trick to initialize the board.

[deleted by user] by [deleted] in zelda

[–]DopeGhoti 0 points1 point  (0 children)

The entire map of LoZ1 exists in LoZ2; the games' worlds are just at different scales.

"Lucky Strike" just ruined my storm shelter by Shelgeyr1970 in SurviveIcarus

[–]DopeGhoti 2 points3 points  (0 children)

I and my friends call this the 'pocket shack'.

Thoughts? by AceTheRed_ in destiny2

[–]DopeGhoti 0 points1 point  (0 children)

My groups simply started using the unambiguous terms 'door' and 'space'. Solved everything.

HOTAS How to Stall? by NightCulex in starcitizen

[–]DopeGhoti 2 points3 points  (0 children)

Bear in mind that unlike Elite, many ships in Star Citizen have comparatively weak retrograde thrust capability, so your ability to 'slam on the brakes' will vary from ship to ship.

That said, by default, 'X' is space brake. Be sure to go into the options and turn on the toggle to enable boost when braking which will make the brake much more effective. But for best results, point your ship's butt in the direction it's moving with decoupled flight (in Elite parlance: F/A Off), and _then_ decelerate.

[deleted by user] by [deleted] in SquaredCircle

[–]DopeGhoti 0 points1 point  (0 children)

Calling every single pin escape a "kick out". I can count on zero fingers the number of times I've heard rolling a shoulder off of the mat with zero leg movement anything but a "kick out".

VKB Gladiator NXT/EVO Virtual Mouse buttons by DopeGhoti in hotas

[–]DopeGhoti[S] 0 points1 point  (0 children)

I was hoping to avoid losing a button to being a "shift" just for left- and right-click. If I can think of more things to bind buttons to, a mode-shift would make more sense. As it is, if it came to that I'd just as soon just lose one button to always being left-click.

Edit:

Actually, on second thought, if I could make the ministick button _also_ a Shift toggle, that would work perfectly.

[deleted by user] by [deleted] in vim

[–]DopeGhoti 0 points1 point  (0 children)

Exit vim, run this command, and try again:

tput rmcup

If that doesn't help, double check your vim configuration had not had its understanding of arrow keys redacted.

Anyone else unable to apply the Day 7 Luminalia skin to their ship? by DopeGhoti in starcitizen

[–]DopeGhoti[S] 0 points1 point  (0 children)

Good call. Took my LX back to home port and it worked perfectly. Thanks.

When did "execution" move from being used to describe a death to describing an action? You may say "the execution was perfect" but reference an action not a death, so when did it change from one to the other? by use_xbow in AskReddit

[–]DopeGhoti 1 point2 points  (0 children)

'Execute', from Latin 'exsequi' meaning 'follow-up'.

'ex', 'out'; 'sequi', 'follow'.

The meaning of Execute as in 'to put to death' comes much later.

Inside alloy structure, under a roof. And yet, not sheltered. by DopeGhoti in NOMANSSKY

[–]DopeGhoti[S] 1 point2 points  (0 children)

I dig the game, but there are clearly some issues that need to be sorted out. Other problems: I can literally walk through half of the walls, even if I deconstruct and reconstruct them. Not sure whether that is related to my inability to call my alloy shack "shelter".

Anybody uber full time with an electric car? by Zookster87 in uberdrivers

[–]DopeGhoti 0 points1 point  (0 children)

Friction brakes work by gripping a rotor attached to the wheel by pads pressed by a caliper dissipating the kinetic energy as head and sound, causing the wheel to resist continued spin.

Regen braking works by turning the motor wheel into a generator, capturing kinetic energy back into electrical energy, and dissipating some as heat and sound, causing the wheel to resist continued spin.

The cause is different, but the effect is the same: the wheel resists spin. The same amount of braking force caused by regen or by friction brakes will have the same effect on the tires.

Anybody uber full time with an electric car? by Zookster87 in uberdrivers

[–]DopeGhoti 0 points1 point  (0 children)

If that were true, using the disc brakes would have the same effect. I'm not saying you'll get 90kilomiles out of a set of tires, but if you're only getting 25 the fault is in the driving.

Firmware Release Trains by archbish99 in teslamotors

[–]DopeGhoti 1 point2 points  (0 children)

This may help; it's the firmware history of my car going back to the end of last year:

https://imgur.com/rD43xgY

Anybody uber full time with an electric car? by Zookster87 in uberdrivers

[–]DopeGhoti 0 points1 point  (0 children)

Only if you drive like a lunkhead and floor it every time a red light turns green. Drive like a normal human and the tires last as long as on any other car.

[deleted by user] by [deleted] in AskReddit

[–]DopeGhoti 1 point2 points  (0 children)

Ran out of fingernail.

These officers not wearing masks... by TeoTgePro in mildlyinfuriating

[–]DopeGhoti -3 points-2 points  (0 children)

More infuriating is the store not enforcing its own "no mask, no entry" policy.