News for hackers. Stuff that matters.

azkae

Re:Claude Code IDE Integration for Emacs on Thursday August 07, 2025 @09:08AM (#44824013)
I am using macher for small edits on a codebase with gptel: https://github.com/kmontag/macher

The package define a list of tools that gptel can use to inspect and edit a project. The tools are packaged as a preset so all you have to do is add "@macher" to your prompt to include the tools & update the system directive.

Re:Structural pattern matching in Python 3.10 on Tuesday September 21, 2021 @08:32AM (#28604383)
You can already do this without pattern matching:

  from typing import Union, NoReturn
  
  class Foo:
      name: str
  
  class Bar:
      size: int
 
  Variant = Union[Foo, Bar]       # or `Foo | Bar` in Python 3.10
  
  def assert_never(x: NoReturn) -> NoReturn:
      # runtime error, should not happen
      raise Exception(f'Unhandled value: {x}')
  
  def tell(x: Variant):
      if isinstance(x, Foo):
          print(f'name is {x.name}')
      elif isinstance(x, Bar):
          print(f'name is {x.size}')
      else:
          assert_never(x)
mypy returns an error if you don't handle all cases.
Re:Zx 3.0 on Monday August 16, 2021 @08:59AM (#28197490)
Yes this wraps subprocess.Popen in a nice API.
Re:Zx 3.0 on Monday August 16, 2021 @08:52AM (#28197429)
Somewhat related, if you are looking to do scripts in Python you should take a look at `sh`:

  import sh
  print(sh.ifconfig("eth0"))
https://amoffat.github.io/sh/
Re:Implementing Rust's dbg! in Python on Friday December 11, 2020 @11:40AM (#25387646)
I use icecream [1] for the same purpose while debugging. It's really handy.

[1] https://github.com/gruns/icecream

Re:Emacs 26.1 released on Monday May 28, 2018 @11:45AM (#17173026)
Scrolling with the trackpad seems way better by default, no more mouse-wheel-scroll-amount/mouse-wheel-progressive-speed hacks !