u/primitive_screwhead
primitive_screwhead
primitive_screwhead
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...)
primitive_screwhead
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.
primitive_screwhead
It's like watching "Crouching Tiger, Hidden Dragon" and complaining that it couldn't happen in real-life.
primitive_screwhead
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.
primitive_screwhead
7 red lines? https://youtu.be/BKorP55Aqvg
primitive_screwhead
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".
primitive_screwhead
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...
primitive_screwhead
Hey, cool, thanks for that!
primitive_screwhead
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?
primitive_screwhead
Bridge engineering.
primitive_screwhead
They'll probably mess it up and call him "Two Punches Man".
primitive_screwhead
Altogether. I personally heard him say in 2005 that "Autism was non-existent in China before the introduction of vaccines."
primitive_screwhead
Loudon Wainwright wrote a beautiful and poignant song about it ("Hank and Fred")
primitive_screwhead
And credit to Rob for always coaxing Bob to reveal more of his mates names.
primitive_screwhead
No, when I responded I thought it was purely for learning purposes.
primitive_screwhead
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).
primitive_screwhead
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
primitive_screwhead
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
primitive_screwhead
"Is it true that you have a degree in Theoretical Physics?"
"It's true that I have a theoretical degree in Physics!"
primitive_screwhead
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).
primitive_screwhead
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.
primitive_screwhead
By actually touching the runner with his empty glove, to hold him on base, is that not obstruction?
primitive_screwhead
At least when he's finally in "the cooler", his hair dye won't melt.
primitive_screwhead
Oh look, it's Otis T Crenshaw!
This is literally the antithesis of git's design (and the design of many other distributed source control systems, not just git).