Hacker News new | past | comments | ask | show | jobs | submit | DemetriousJones's comments login

One of my biggest gripes with python is the fact that the only way to create a local scope for variables is with functions.

I understand if statements not having their own scope for simplicity's sake, but the fact that `with` blocks don't is simply mind-bobbling to me. ``` with open("text.txt", 'w') as f: f.write("hello world") f.write("hello world") # at least the handle was automatically closed so it will give an IO error ```


It’s actually very useful to have context managers outlive their with blocks. They are not only used for files:

One example would be a timing context manager:

   with Timer() as t:
      …
   print(t.runtime)
Another example is mocks, where you want to inspect how many times a mock was called and with what arguments, after the mock context manager has finished.


I know it makes sense in the "scope-less" python philosopy but it still feels weird for me as a scope (ab)user in C++ and has caused me one headache or two in the past


I learned about the `scoping` package today. Idk if it works exactly as I expect from other langs, though.


Sorry for the borked code formatting


I tried running the 8B model on my 8GB M2 Macbook Air through Ollama and it was awful. It took ages to do anything and the responses were bad at best.


Doesn't 8B need at least 16gb of ram? Otherwise, your swapping I would imagine...


Depends on quantization selected - see https://www.canirunthisllm.net/


The missing requirement might be no TPM 2.0


Same, the web view in my Android client crashed after a couple seconds.


I wonder if it's all the Godbolt iframes. Do you have the same problem on other pages, like https://blog.reverberate.org/2025/01/27/an-ode-to-header-fil... ?


Yeah, I think it's all those iframes. I'm seeing something weird on my Linux desktop - all the godbolt iframes crash on reload unless I have another tab with godbolt open. I didn't see anything obvious in Chrome's log.

I can't replicate the crash at all on my Linux cloud VM though. Usually the only difference there is that advertisers tend to not buy ads for clients on cloud IPs.


Other pages on the site work fine for me yeah. But the OP blog post is crashing my Android browser, like the other commenters have mentioned.


Yeah no problem on other pages


Latest press release: "FTC Grants Chairman Ferguson Authority to Comply with President Trump’s Orders to End DEI"


Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: