Login
You're viewing the techdon.dev public feed.

Replies

  • 💬 1🔄 6⭐ 41
  • Nov 6, 2026, 2:14 AM

    I think this coder may have been trying to do manual memory management in python

    they do, like:

    def get_url(url):
    response = request.get(url)
    document = json.loads(response)
    response=None # <-- this line
    return document

    like, that almost makes sense in C, right? they're freeing the HTTP response. but this is python, we have a reference-counting garbage collector

    💬 3🔄 3⭐ 36
  • 💬 1🔄 1⭐ 12
  • Nov 6, 2026, 3:28 AM

    as someone who has been a python programmer since I was struck by the beauty of language when I first encountered it around 2006, this code is doing something with python, where...

    It's like being a concert violinist and watching someone use a Stradivarius to hammer in a nail.

    💬 0🔄 6⭐ 14
  • 💬 0🔄 0⭐ 0
  • Nov 6, 2026, 6:36 AM

    @foone Actually, I believe in reference counting, but I have learnt, that I write "bogus" Python code, which is optimized for CPython (default) but may fail in other, faster Python implementations... (I believe PyPy).

    (Fun fact is, that PyPy would probably require del, because this assignment to None also works only with reference counter...)

    💬 0🔄 0⭐ 0