Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's an obscure Python quirk that default parameters are constructed during compilation time and then never re-constructed. So, to illustrate:

  >>> def hello(a=[]): a.append('hello'); return a;
  ... 
  >>> hello()
  ['hello']
  >>> hello()
  ['hello', 'hello']
On post, what mindslight said.


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: