ãã¾ããã ãã©ã http://0xcc.net/blog/archives/000043.html ã® Python ã®é¨åãæ·»åã
- len(a) == 0 ã¯ã if a: ã®ããã«ãªã¹ãèªä½ã空ã®æã«å½ã«ãªãã®ã§ä½¿ããªãã
- a.pop(0) 㯠del a[0] ã¨ãæ¸ãããã©ã¡ãã§ãè¯ãããå¤åå±æ§åç §ãç¡ãå del ã®æ¹ãé«é
- a[:] = [] ãåãã del a[:]
- a.remove(x) â»æåã®ä¸ã¤ããåé¤ãããªã ã¯ããã¹ã¦ã®xãåé¤ããããªã a = [y for y in a if y != x]
- del(a[i]) ã¯ã del ãé¢æ°ã§ã¯ãªãã®ã§ del a[i] ã¨æ¸ãã
- Ruby ã® a.uniq ã¯ãã½ã¼ãæ¸ã¿ã«å¯¾ããæä½ãããªãããï¼ éè¤ãåé¤ããã ããªã set(a) ã§ããããã©ãé åºã®ä¿åãå¿ è¦ãªã z = []; for x in a: if x not in z: z.append(x) ããæãã¤ããªããªãã(è¦ç´ æ°ãå¤ãã¨ãã¯setãä½µç¨) Python 2.7 ã 3.1 以éãªã OrderedDict ã使ããã½ã¼ãæ¸ã¿ã®ãªã¹ãã対象ã§ããã° a = [x for x,_ in itertools.groupby(a)] ãå¯ã