aeris22’s avataraeris22’s Twitter Archive—№ 57,081

      1. Je hais python, épisode 154789421346499… Il n’y a pas de safe get sur les list. List qui étant un built-in ne peut pas être monkey patché
    1. …in reply to @aeris22
      histoire de pouvoir faire facilement un « my_list.get(n) » Donc faut def list_safe_get(list_, index, default=None): try: return list_[index]
  1. …in reply to @aeris22
    except IndexError: return default from .utils import list_safe_get list_safe_get(my_list, n) (Oui parce que tu ne peux pas onliner ça non
    1. …in reply to @aeris22
      plus…) #FuckingPython #ReimplementObviousThings