Skip to main content


Personal growth is hard when you leave no room (time) for it.


Tried using the CFFI library with libmtp to put together a script for grabbing photos off my phone, but libmtp didn't like #Android's custom flavor of MTP. Ended up just wrapping aft-mtp-cli instead. 👍 #Python



PEP 703 – Making the Global Interpreter Lock Optional in CPython


CPython’s global interpreter lock (“GIL”) prevents multiple threads from executing Python code at the same time. The GIL is an obstacle to using multi-core CPUs from Python efficiently. This PEP proposes adding a build configuration (--disable-gil) to CPython to let it run Python code without the global interpreter lock and with the necessary changes needed to make the interpreter thread-safe.


#python #programming #gil

Andrew Sterian reshared this.



I was originally annoyed by this, but I think it's probably for the best. #python #linux
% sudo pip install python-magic
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
    python-xyz', where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Arch-packaged Python package,
    create a virtual environment using 'python -m venv path/to/venv'.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.
    
    If you wish to install a non-Arch packaged Python application,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. Make sure you have python-pipx
    installed via pacman.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

in reply to Neil E. Hodges

how did we get to the point when we're surprised that a repository includes the latest version of a tool released "just" half a year ago? Now I see why people talk that much about #NixOS.
in reply to gram

@orsinium I know somebody who is very disappointed that bookworm doesn't have golang 1.20 when it was released "months ago". I think I can see why - bookworm was already partially frozen then. But explaining this doesn't help.

On the other hand it does look like golang 1.20 got into nixos 23.05, if I am reading this correctly.

@gram
in reply to gram

@orsinium

Thats quite fast for debian.
And that being fast for debian, is the mainreasen to not use debian on the desktop. (Which I did for a very long time btw.)

@gram

Neil E. Hodges reshared this.


I think I found a #Python #bug today. If you try to do a csv.writer.writerow() and one of the strings (not bytes) in the row contains a null character in it, and you are using a csv.Dialect with escapechar set to None, it will result in this condition evaluating to true when it shouldn't. That will almost immediately result in the need to escape, but no escapechar set exception being thrown. #programming

reshared this



Fixing the GIL with from concurrent.futures import ProcessPoolExecutor. #Python

Neil E. Hodges reshared this.


Learned a new #Python trick on the job:
@contextmanager
def func(…):
    resource = …
    try:
        yield resource
    finally:
        …

#programming

reshared this