« first day (4209 days earlier)      last day (740 days later) » 

3:11 AM
Is there anyone that can review my code and tell me my mistakes? I am kinda stuck and can't progress nor see my mistakes to counter them
 
Wes
3:24 AM
you can put it on github or similar and link it to us
 
What is your question? You've described your program but I'm not sure what your question is. — John Kugelman 27 mins ago
sorr
y
2
Q: I am trying to make a basic Grocery Store without prices

Djohnworthyclass Toptanci: def __init__(self): self.fruits = dict(apple=30, pear=40, cherry=20, banana=10, strawberry=15) self.vegetables = dict(garlic=40, Tomatoes=30, Eggplant=40, Onion=25, Potato=15) self.all_list = self.fruits and self.vegetables ## YANLIS OLABILIR ! def report(self): ##...

 
3:42 AM
@PM2Ring Not that one about scraper sites in general, but ones with malware/misleading JS like roganjosh mentioned, as grounds for getting them blacklisted by both SO and Google. There is no forum on SO/SE where we can (discreetly) mention them.
 
Wes
    try with this design @Djohnworthy

    class ProductCategory():
        def __init__(name: str):
            pass

    class Product():
        def __init__(name: str, stock: int, categories: set[ProductCategory]):
            pass

    class Stock():
        def add_product(product: Product):
            pass

        def buy(cart: dict[Product, int]):
            pass
sorry for multiple ping
class Stock could be named class Store
 
4:01 AM
Thanks a lot
 
4:15 AM
hey all, is "not in" an operator in python they way "is not" is?
 
Hello guys, I got a odd error for you guys. Does anyone here have experience with Jupyter notebook?
I am trying to install simpy but I get the following error:

AttributeError: module 'pexpect' has no attribute 'TIMEOUT'
everything I keep finding online just tells you to use this command:
!{sys.executable} -m pip install simpy
But that is what I am already doing so I am at a loss currently
This happens when I install any python package
 
5:19 AM
Cbg
 
6:02 AM
morning cbg, folks
 
@MisterMiyagi How was the weekend ?
 
Rainy, uneventful, and very relaxing.
How about yours?
 
Same, it's nice to have a break
It was voting day here yesterday
 
6:25 AM
checks profile Ah, I see. Been following things on the news a bit.
 
6:44 AM
Heh
Good to see sanity prevailing in some placess still
 
Without opening politicians box on a Monday morning: What Andras said.
 
7:14 AM
No thanks necessary :'(
 
 
1 hour later…
8:40 AM
@smci If a site could trick a user into entering their Stack Exchange login details, then you should report it to Stack Overflow, as mentioned on that MSE FAQ. If that's not the case, but the site serves malware, you should report the site directly to Google using the spam report tool, as mentioned on that page under "What actions can I take myself?".
The Malware page specifically says: "Please do not post serious security issues publicly on a meta site or elsewhere".
Ah, ok. I just looked at the transcript again & see that you know about reporting to Google. chat.stackoverflow.com/transcript/6?m=54401875#54401875
Also, it appears that you're talking about general malicious sites that pretend to help coders, not just sites that imitate SO.
 
 
2 hours later…
10:46 AM
@MisterMiyagi thanks, but why is there not an equivalent in the operator docs?
I want not_contains but right now I am just wrapping it in a lambda and adding a not
 
You mean the operator module?
For the most part, those only represent things that correspond to special methods.
 
yeah, that one, it has one for in, it even has one for is not, so I was hoping one for not in
 
A not in B and A is not B are just fancy ways to say not A in B and not A is B.
 
@MisterMiyagi is not does not have a dunder right?
 
Ah, wasn't even aware of that one. ^^
 
10:49 AM
not in is just syntactical sugar because it reads better than not A in B
I want to say no sane class should want to define in and not in separately but we also have __ne__
 
I mean, it makes sense, but it kinda seems inconsistent to have one for is not but not for not in
 
for what it's worth I didn't even know it had is_
in that case I agree
 
I'm guessing operator.not_in is due to TAGNI.
 
func = contains if some_condition else lambda x, y: not contains(x, y) this is my work around
what does the T stand for?
 
10:52 AM
lol, maybe, so my workaround is as good as it gets?
 
@Jake "They". Many odd tools just don't exist because no one needed them badly enough to add them.
 
You could also do func = lambda x, y: (x in y) == some_condition
 
@Jake I get the feeling that could be improved, but not by much
for some reason I'd be tempted to use a single function that chooses internally based on some_condition
 
If you have a custom function anyway, lambda x, y: y not in x is likely better.
 
10:57 AM
@MisterMiyagi this is a lot better, I imported the contains so wanted to use it anyways, trying to wrap my head around Aran-Fey's suggestion
they did add operator.call for some reason, so there is hope that they add not in some day
 
for all that sweet functional programming *chef's kiss*
 
IIRC operator.call also was added only because someone had a very specific itch to scratch.
 
Jan 12 at 21:32, by Andras Deak
I'm looking forward to seeing how people will use that to avoid opting for a clear comprehension
 
@Aran-Fey so I gave up, how does this work?
 
I kinda like the motivation of mapping f1, f2, f3, ... onto args1, args2, args3, ... all at once or even via concurrent.futures.
 
11:07 AM
@MisterMiyagi you mean pool.submit(operator.call(f1, args1, ...)) vs pool.submit(f1, args1, ...)?
 
pool.map(operator.call, (f1, f2, f3), (a1, a2, a3), (b1, b2, b3))
 
@Jake I'm not sure what to explain there to be honest... it's just an in and an equality check
 
yeah, I kinda understand how it works, just don't know why it works, idk how to explain
 
@MisterMiyagi Requires too many brain cells for my taste
 
Admittedly, it was more appealing before I wrote it down.
 
"This would be nicer with async" I dare say, actually. But so far I couldn't be arsed to finish my library that makes it nicer, so we're back to TAGNI, I guess.
Actually, just having Pool.__call__ as an alias to Pool.submit would likely improve things a lot already.
 
The alternative is to define an unpacking wrapper wrapper for the function, right?
And pool.mapping that to the zipped args I mean.
 
Annoying thing of the day: Dentists who schedule your 40-minute long appointment at 12, and afterwards tell you you're not allowed to eat or drink for an hour
 
Huh, what did they use as filling? Last time I checked you only had to avoid coffee and tea for fear of staining the fresh filling...
Wait 40-minute long? Woof.
 
No filling. It was basically a professional tooth cleaning, and they put some sort of gel on the teeth at the end
 
11:32 AM
Huh
perhaps it makes your teeth softer
 
Wes
fluoride?
 
No idea, all I know is that it's yellowish in color and has an unpleasant taste
 
don't eat the yellow snow paste
 
11:50 AM
I don't think that's the reason why they told me not to eat anything...
 
12:29 PM
My last android update finally broke SE mobile, so sad. What am I gonna do now on the toilet :(
@Aran-Fey We call it colloquially a DH
 
Dental Hygiene?
 
12:44 PM
yes
 
I'm guessing the thing being called "DH" is "the process of going to the dentist and getting a professional tooth cleaning", and not "the process of putting some sort of gel on a patient's teeth"
"I can't make today's status meeting, I have a DH appointment" is sensible. "I was hoping my dentist would give me just flouride, but he applied DH instead" sounds a bit odd to my ear
 
correct yes
I'm learning ansible atm and it seems quite verbose
 
Yeah. We call it "tooth hygiene" over here. Which makes it sound much more pleasant than it really is
Throw out that mental image of a nice day at the spa and replace it with a construction worker using power tools on your teeth
 
There are huge differences in DHs tough. My last one was the best one ever, not sure if they didn't do it thoroughly or I cleaned my teeth really good lately or they just did it very well, but it was so smooth, I nearly fell asleep :D
 
12:59 PM
Admittedly, my teeth weren't in great shape
 
My cleaning appointments tend to be 85% boredom, 10% soreness from repeated "open wider please" requests, 5% anxiety. It's a good time to practice entering a dissociative state.
Gotta keep your dissociation skills sharp so you can retreat to your happy place during work meetings that could have been an email
 
I could never do that, I'm too busy wondering what the heck they're doing to my poor teeth
 
@Kevin pro tip, bring your laptop so you can just do work instead of dissociating :) Pretend that you are taking notes
 
You can still do that if you want. Sometimes when I'm at the bottom of my dissociation well, I look up at the distant circle of light, where the waking world is. "Oh, somebody is at the dentist. I wonder what they're doing to him".
@Hakaishin Sounds difficult, geometrically. With the chair being reclined as it is, I would have to tape the laptop to the ceiling to get a clear view of it.
 
1:15 PM
I meant during the meetings that could have been an email, not during the DH :D During that I close my eyes and try to meditate
 
just put a mirror on the ceiling instead
 
 
there you go, perfection
 
Has anybody ever tried those glasses? I always wondered if they would be nice
 
I'm trying to work out whether the text would look backwards or not
I'm guessing, it looks backwards if the glasses use a mirror, and frontwards if the glasses use a prism
 
1:21 PM
ooh im not familiar with how prisms work, that's interesting. i think youre right about the mirror for sure, which would be a bummer. i wonder if theres a way to arrange mirrors so as to unflip it?
 
I suspect so, although it might be hard to pack the required setup into a small space
It's certainly possible to arrange two mirrors so that the image appears to be rotated 180 degrees about the up-down axis rather than reflected over the up-down-left-right plane. You just need to place two mirrors at right angles to one another.
Like so. So we know that it's possible to un-flip a flipped image. Now we just need to do it with a final rotation of 90 degrees rather than 180.
A rudimentary proposal. The image of the book travels from west to east and strikes the first mirror. It gets mirror-reversed, and its path rotates clockwise 45 degrees. It strikes the second mirror, reversing it a second time, and rotating it 45 degrees a second time. It travels south to the eye, which sees a book with non-flipped text.
Questions left as an exercise to the reader: what happens to light particles that strike the mirrors, but don't strike them neatly in the center? How do the lengths of the mirrors relate to the total field of view the eye can perceive through them? What about the distances between the eye and the mirrors and the book?
(I don't know the answer to these)
Proposal 2. I think this will give the eye a wider field of view, because the light strikes the mirrors at a more direct angle. I wonder If a four mirror setup could give an even better FOV...
 
1:55 PM
Welcome to DSLR design
Well, the viewport or whatsitsname
 
2:10 PM
en.wikipedia.org/wiki/Pentaprism looks pretty close to my proposal 2. The angles of reflection are the same.
 
"while a pentaprism's facets are perfectly aligned until it is destroyed." That's how I'm gonna describe my next software pitch: "The software is perfect and will work until it is destroyed." xD
 
I have an idea for a device that lets you view the back of your head. three to five rods are connected end-to-end by two to four flexible joints. On each joint there is a mirror, aligned in a particular way. If you look down rod A head-on, you will also see rod B head-on through the mirror at A and B's joint. And transitively, you will also see rods C and D (etc) head-on.
 
@Kevin here you have 5million, now go and make us rich :D
 
Aligning the mirrors properly is the primary challenge. If rods A and B meet at a 90 degree angle, then the mirror should be at 45 degrees. If you bend the joint by N degrees, the mirror needs to rotate by N/2 degrees to compensate.
 
2:27 PM
@Kevin but I'm pretty sure the pentaprism flips the image, because it gets light from the mirror in front of the sensor
 
If I'm looking at the diagrams right, the pentaprism comes in both flippy and non-flippy varieties. Actual cameras use the flippy variant, for reasons.
 
the reason being the mirror
 
Optics in a nutshell: "we need a mirror to undo the disastrous effect of the previous mirror"
 
The newer digital camera design called a MILC (mirrorless interchangeable-lens camera) removes the mirror which is great for the other kind of pentaprism, but unfortunately it also removes the viewfinder so there's no pentaprism needed in the first place...
 
3:17 PM
I much prefer mirrorless viewfinders
 
3:29 PM
DSLRs are heavier and bulkier than mirrorless cameras in general, in part because of all those mirrors and prisms, while offering very similar or even slightly worse viewfinders
(IMO)
 
3:59 PM
@Kevin : this guy cameras
 
4:24 PM
@kevin On xorg systems you can use xrandr to reflect the display. x.org/releases/X11R7.5/doc/man/man1/xrandr.1.html There are Windows solutions, but they aren't free. There are also hardware devices that can reflect the monitor signal, but I guess that's not much use to reflect the display on a laptop's built-in screen. Some display hardware may offer a mirror mode, but it might be tricky finding software to control it.
FWIW, teleprompters generally need a reflected display, but they tend to use a hardware solution. Similarly, projectors & old video arcade games used monitors with the reflection handled by the monitor hardware.
 
Is there a sane way to repeat all test functions in a specific file a certain number of times? Googling led me to pytest-repeat, but that 1) requires me to decorate each function individually and 2) uses a stupid hack that changes the test id and prevents vscode from finding the test result
I basically just want to repeat each test 10 times to make sure it doesn't have a heisenbug. I don't need to (don't want to, in fact) see 10 results for each test. It should fail if one of the 10 runs fails and that's it
 
This sounds like a scenario where it makes sense to run the test script in a loop in a batch file.
 
Actually, I can just write my own decorator with a for _ in range(10): func()...
 
The Windows mirror-flip program is Ultramon. superuser.com/questions/554589/…
@ParitoshSingh Don't forget the pink champagne on ice.
 
4:57 PM
@Aran-Fey perhaps you could make use of hypothesis but that knows a lot more
not sure if that needs each test to be decorated
 
@Aran-Fey Are you sure that's enough? Most of my Heisenbugs were hash/set related, only running with a different hash salt triggered them.
 
Oh, good point. I think it helped, but I'll make sure once I've managed to return my code into a state where my tests don't fail 100% of the time...
 
5:16 PM
FWIW, I'm now hunting a Heisenbug for weeks, so take my advice with a grain of salt. ^^
 
5:27 PM
I realized pickle doesn't have this problem... maybe I should rethink my file format
 
5:39 PM
The loop definitely helps, so that's good
 
@PM2Ring haha yes! it's the perfect prison after all, made by ourselves
 
 
3 hours later…
9:14 PM
@vaultah how do you even know you're taking a photo if it doesn't go CLICK?
 
cbg
@AndrasDeak--СлаваУкраїні if the prism doesn't go brrrt did you even take a picture?
 
9:33 PM
@AndrasDeak--СлаваУкраїні oh it does go CLICK. Even mirrorless camera have mechanical shutter :P
 
Yeah, but it's not the same without kickback :(
at least the prism in my DSLR will never break because it's a low-end frame which has mirrors instead of a prism
 
@AndrasDeak--СлаваУкраїні It's a quieter and cuter click, but it still sends a bit of feedback to my palm. Actually the amount of kick DLSRs have can affect the resulting image, which is especially noticeable on high-resolution cameras. If you pixel peep you may notice lack of sharpness, even if you use a heavy tripod
Which is one of the reasons I decided to go mirrorless
 
When it comes to photography I'm right at the top of mount stupid so I'm very insistent on DSLRs :P
a friend showed me a video a few months ago where a MILC shutter ended up being louder than a DSLR I think
@vaultah ah, that might be the exact video
 
10:01 PM
Hmm, right. I guess I have the loudest MILC :D
It doesn't have the DSLRs "mirror slap", so that still makes it better than DSLRs, in my eyes at least
This might be a better comparison: youtube.com/watch?v=7S8u6BXt7sM (I have Sony A7R3)
 
yeah, I totally see how that's functionally better, but I like the slap :'D
 
 
2 hours later…
Wes
11:56 PM
are return raise continue break only statements, right?
or can i do stuff like continue if foo is False
 
You can't
Not yet
 
Wes
is it in the works?
 
I sure hope not
 
Wes
lol i thought with "not yet" you implied it was going to be a thing eventually
 

« first day (4209 days earlier)      last day (740 days later) »