- 6 Posts
- 131 Comments
sajran@lemmy.mlto C++@programming.dev•Checking if a hash is collision free on a limited domain2·11 months agoI like the problem solving description, I actually went through a similar learning process leading to bitset recently. It was very satisfying!
However, I just have to ask a question: What is the reason you didn’t just use UUID?
sajran@lemmy.mlto Python@programming.dev•How should I deal with multiple imports having the same name?4·1 year agoSince you have all your
shutil.copytree
s andsys.path
manipulation at the top level of the test modules, they are executed the moment those modules are imported.unittest
likely imports all discovered test modules before actually executing the tests so the set up of both modules is executed in random order before the tests are run. The correct way to perform test setup is usingsetUp
andsetUpClass
methods ofunittest.TestCase
. Their counterpartstearDown
andtearDownClass
are used to clean up after tests. You probably will be able to get this to work somehow using those methods.However, I’m fairly certain that this entire question is an example of the XY problem and you should be approaching this whole thing differently. Copying the modules and their mock dependencies into a temporary directory and manipulating
sys.path
seems like an absolute nightmare and it will be a massive PITA even if you get it to a working state. I don’t know what problem exactly you’re trying to solve but I think you should really read up onunittest.mock
and even more importantly on dependency injection.
This is great news but I just have to say it: we need Proton Drive on Linux. Still very happy though.
sajran@lemmy.mlto Android@lemdro.id•I made a tool to measure the battery impact of different Android web browsers - here's what I learned!English6·1 year agoVery interesting experiment. Thanks for sharing! Maybe I’ll find some time to run the benchmarks on my Pixel 7 in the upcoming days.
But… How do you even know you can smell ants? Why did you try it? Or can you smell them from meters away?
But… How do you even know you can smell ants? Why did you try it? Or can you smell them from meters away?
sajran@lemmy.mlto Science Memes@mander.xyz•This product will eliminate odours in your home, but only in one planeEnglish13·1 year agoI might be wrong but I assumed it’s perfectly obvious to OP and it’s the kind of joke where something is funny because you stretch the meaning to read it literally. I chuckled actually, despite it making perfect sense.
sajran@lemmy.mlto 196@lemmy.blahaj.zone•TFW the universe rips you from your everyday existence in an instant to remind you that you are tiny, it is immense and everything is subject to change (edit: rule i guess)English3·1 year agoMan, I didn’t get what I’m looking at at first. But after reading the description and watching the video - pretty amazing!
sajran@lemmy.mlto Programmer Humor@programming.dev•Not really sure whether S-expressions or Python indentation-based scoping get more hate...English4·1 year agoOf course, but when indentation has a syntactic meaning the formatter often won’t be able to fix it.
sajran@lemmy.mlto Programmer Humor@programming.dev•Not really sure whether S-expressions or Python indentation-based scoping get more hate...English1·1 year agoIt’s probably more prone to mistakes like that, true. But in practice I really never witnessed this actually being a problem. Especially with tests and review.
sajran@lemmy.mlto Programmer Humor@programming.dev•Not really sure whether S-expressions or Python indentation-based scoping get more hate...English1·1 year agoYeah, that’s definitely a good point. But it’s a minor thing. Adjusting indentation takes 2 keystrokes in vim, I barely notice it.
sajran@lemmy.mlto Programmer Humor@programming.dev•Not really sure whether S-expressions or Python indentation-based scoping get more hate...English213·1 year agoSo I’m going to say what I always say when people complain about semantic whitespace: Your code should be properly indented anyway. If it’s not, it’s a bad code.
I’m not saying semantic whitespace is superior to brackets or parentheses. It’s clearly not. But it’s not terrible either.
As someone who codes in Python pretty much everyday for years, I NEVER see indentation errors. I didn’t see them back when I started either. Code without indentation is impossible to read for me anyway so it makes zero difference whether the whitespace has semantic meaning or not. It will be there either way.
sajran@lemmy.mlto Technology@lemmy.world•How are Microchips Made? | Branch EducationEnglish9·1 year agoI absolutely love the videos on this channel, this one being one of the best published yet. I’m literally blown away by the level of detail and clarity. I think I’m going to watch it more one time…
Exactly this worked for me. Just be consistent until it sticks. It can take months, easily. But it works in the end. 10:30 pm - 6:00 am is now baked into my mind and I usually just wake up naturally like 10 minutes before the alarm. I actually love it 😁
So, your original comment sounded very relatable and I never heard about an AQ test before. Just took one and got 34. Well…
(For the unfamiliar: 34 out of 50, over 32 means you should probably go and get a real diagnosis.)
sajran@lemmy.mlto Technology@lemmy.world•Google layoffs: Sundar Pichai-led company fires entire Python team for ‘cheaper labour’English361·1 year agoYou are only starting to think that NOW?
sajran@lemmy.mlto Unpopular Opinion@lemmy.world•Introvert\Extrovert is pop psychology nonsense.8·1 year agoIt’s really not about enjoying or not enjoying social interactions. It’s about your default state. So when I finish work I think “finally some time to spend by myself: learning, reading, gaming, whatever”. When my extrovert friend finishes work they think “finally I can meet with my friends”. I love my friends and I enjoy spending time with them but I do it like once a week and I would be exhausted if I had to spend every evening with them. My extrovert friend rarely spends evening without any company and if they do they will often call someone because not interacting with anyone is just weird to them.
sajran@lemmy.mlto Web Development@programming.dev•Hardest Problem in Computer Science: Centering ThingsEnglish8·1 year agoThe article is very interesting but the fake cursors are infuriating and make it nearly impossible to focus on the content. It’s a clever joke but without a way to disable it, the author is just sabotaging his own content.
But Nothing Phone isn’t a Pixel, is it? Yeah, I think it’s probably closer to the Pixel’s clean software experience than Samsung’s bloated one, but still, this doesn’t seem to be fair comparison.
Ah, I didn’t think about this. Thanks for the explanation!