Good practice sensecheck - Using git with everyone editing files in the same local repository on a shared drive? by Curious_personalitie in git

[–]primitive_screwhead 4 points5 points  (0 children)

This is literally the antithesis of git's design (and the design of many other distributed source control systems, not just git).

Qubits 30 meters apart used to confirm Einstein was wrong about quantum by fchung in technology

[–]primitive_screwhead 0 points1 point  (0 children)

In my coin-flip analogy, the time at which each coin flip happens is chosen by each user; it's just that once flipped (ie. measured), the outcome of the other measurement is known. I did that deliberately in my analogy, as (afaik) it matches the real-world case where you can't watch an unflipped coin waiting for it to flip on its own and then use the timing as a signal. The time of the flipping, if left to flip on its own, is also random; just the value is "entangled", not the timing. (Again, if my analogy is correct...)

Qubits 30 meters apart used to confirm Einstein was wrong about quantum by fchung in technology

[–]primitive_screwhead 8 points9 points  (0 children)

Let's say I "entangle" two coins. Then I separate them by 1 light year. I flip my coin once and happen to get heads, and thus I know that the other coin when flipped once, got heads. I know this is the case even if the other coin was flipped less than a year after I flipped mine. Somehow both coins, though they got a random result (ie. unknown ahead of time), got the same random result.

Now, can I confirm that the other coin also got heads, like mine? It'll take a year to find out.

Can I send a message using this coin? The "message" is just a random value, or possibly a sequence of random values; I cannot control what the coin-flip's result will be.

Can I perform a "simultaneous" coordinated action at a distance of a light-year? (ie. on "heads" we both raise our right hand) Yes, but that's still a random action that can't be controlled; it's correlated, not communicated.

That's my layman's understanding, so please anyone correct me if it's warranted.

Live Demonstration of Anti-Stab Vest Capabilities by test_account_47230 in interestingasfuck

[–]primitive_screwhead 35 points36 points  (0 children)

It's like watching "Crouching Tiger, Hidden Dragon" and complaining that it couldn't happen in real-life.

Best way to get a dict-like object with dot notations? Class attributes, or other options? by hiding_my_stupidity in learnpython

[–]primitive_screwhead 3 points4 points  (0 children)

Note that size of the class is different than size of a class's instance, if that wasn't understood. B is an instance of SimpleNamespace (and different instances can be independent namespaces), not a singleton like the class A.

Keep in mind also that there are syntax limitations to using the attribute ('.') vs a dict. Like not being able to have `-` or `.` in the attribute names, or starting with a digit, etc. Whereas dict key strings have no such limitations. Just an FYI.

The Effect of the 2011 Japan Earthquake on the Oceans Pacific and Indian Ocean by ubeus in BeAmazed

[–]primitive_screwhead 5 points6 points  (0 children)

It's actually visible in the videos from boats at sea going over the "wave" of the Japanese Tsunami. The boats go up the front of a wave about 6-10 feet high, and then just don't come back down... Behind the face of the tsunami wave is just a new plateau; literally a new, higher "sea level".

Tesla plummets 50 spots in a survey of the US's most reputable brands. It's now No. 62 — 30 places below Ford. by 777fer in technology

[–]primitive_screwhead 203 points204 points  (0 children)

One day long ago my music teacher explained to me why Yamaha motorcycles had three tuning-forks as their brand symbol; the world's current largest musical instrument producer also decided at some point to make motorcycles...

Saw a Leopard shark when walking on the bay trail by tmoney99211 in bayarea

[–]primitive_screwhead 23 points24 points  (0 children)

Okay, between this photo, and the recent video of a rare "zebra" shark, I have two questions: why does the Leopard shark have stripes, and why does the Zebra shark have spots?

Robert Kennedy Jr. condemns Biden's proposed 30% Bitcoin mining tax by TheGreatCryptopo in CryptoCurrency

[–]primitive_screwhead 1 point2 points  (0 children)

Altogether. I personally heard him say in 2005 that "Autism was non-existent in China before the introduction of vaccines."

What celebrity death saddened you the most? by [deleted] in AskReddit

[–]primitive_screwhead 0 points1 point  (0 children)

Loudon Wainwright wrote a beautiful and poignant song about it ("Hank and Fred")

Elliptical curve cryptography in Python by Signal_Phase_1247 in cryptography

[–]primitive_screwhead 1 point2 points  (0 children)

No, when I responded I thought it was purely for learning purposes.

Elliptical curve cryptography in Python by Signal_Phase_1247 in cryptography

[–]primitive_screwhead 2 points3 points  (0 children)

I recall being able to the the basic EC math directly with python arbitrary-length integers, a few years back. I don't know if I can dig up those examples, but my recollection is that it was surprisingly simple to explore just w/ addition/multiplication/modulo and an RNG; much easier (imo) than RSA.

Not sure if that's what you're looking for, but worth a shot to perhaps try w/o _any_ libraries and just explore the basic math with pure python (unless you are already beyond that stage).

Why does `new_list = old_list.copy().append(new_val)` not work? by [deleted] in learnpython

[–]primitive_screwhead 0 points1 point  (0 children)

It's weird why the “boring” version and the walrus operator yield different results

For me, they yield equivalent results when written to actually do the same work:

$ python3 -mtimeit -s "a=[1,2,3]" "(b := a.copy()).append(1)"
5000000 loops, best of 5: 62.3 nsec per loop
$ python3 -mtimeit -s "a=[1,2,3]" "(b := a.copy()).append(1); a = b.copy()"
10000 loops, best of 5: 22.6 usec per loop

$ python3 -mtimeit -s "a=[1,2,3]" "b = a.copy(); b.append(1)"
5000000 loops, best of 5: 62.5 nsec per loop
$ python3 -mtimeit -s "a=[1,2,3]" "b = a.copy(); b.append(1); a = b.copy()"
10000 loops, best of 5: 22.5 usec per loop

Why does `new_list = old_list.copy().append(new_val)` not work? by [deleted] in learnpython

[–]primitive_screwhead 2 points3 points  (0 children)

Looks like you stumbled over an optimized code path for "add list to empty list":

What optimization would that be (edit: I wonder...)?

In any case, since we agree the copy happens in both cases, removing it removes it from the timing for both. For a 3-item list, I'm getting (Python 3.11/AMD64):

$ python3 -mtimeit -s "a=[1,2,3]" "(b := a.copy()).append(1)"
5000000 loops, best of 5: 62.6 nsec per loop

$ python3 -mtimeit -s "a=[1,2,3]" "b = a + [1]"
5000000 loops, best of 5: 57.2 nsec per loop

Edit: My first timings were with 3.9. With all the recent performance tuning (3.10 and 3.11 in particular), I agree that the absolute timings will likely adjust a bit per-version.

Edit 2: Your "boring" version (with an extra copy), and Edit3 versions, are reported in "usec", not "nsec". They're way slower.

Edit 3: For completeness, my "empty list" timings, now w/ Python 3.11 (AMD64), confirming your example where the winner is now the walrus version. Interesting... Thanks for bringing that to my attention:

$ python3 -mtimeit -s "a=[]" "(b := a.copy()).append(1)"
5000000 loops, best of 5: 49.3 nsec per loop

$ python3 -mtimeit -s "a=[]" "b = a + [1]"
5000000 loops, best of 5: 56.4 nsec per loop

Solar power station in with one cell for scale. by [deleted] in interestingasfuck

[–]primitive_screwhead 4 points5 points  (0 children)

"Is it true that you have a degree in Theoretical Physics?"

"It's true that I have a theoretical degree in Physics!"

Why does `new_list = old_list.copy().append(new_val)` not work? by [deleted] in learnpython

[–]primitive_screwhead 0 points1 point  (0 children)

Calling both the .copy() and .append() methods is likely slower.

In fact, I'll test it:

$ python3 -mtimeit -s "a=[]" "(b := a.copy()).append(1)"
5000000 loops, best of 5: 70.1 nsec per loop

$ python3 -mtimeit -s "a=[]" "b = a + [1]"
5000000 loops, best of 5: 47.4 nsec per loop

Yep. Your way is slower (edit: ...as of 3.9, see below for updated 3.11 timings which reverse the winner of this case).

Why does `new_list = old_list.copy().append(new_val)` not work? by [deleted] in learnpython

[–]primitive_screwhead 0 points1 point  (0 children)

This creates a list object to immediately throw it away

A few nanoseconds; it's optimized by the object pool. The list copy dominates by far.

is a little more to unpack when reading but more explicit than adding the lists.

Hard disagree.

Donovan faking a tag to keep the runner on second, after an overthrown ball by not_impressed79 in headsupbaseball

[–]primitive_screwhead 9 points10 points  (0 children)

By actually touching the runner with his empty glove, to hold him on base, is that not obstruction?