1. Список говнокодов пользователя cxielamiko

    Всего: 1

  2. Python / Говнокод #8767

    −89

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    def get_caller_module_dict(levels):
        try:
            raise RuntimeError
        except RuntimeError:
            e,b,t = sys.exc_info()
            f = t.tb_frame
            while levels > 0:
                f = f.f_back                   
                levels -= 1
            ldict = f.f_globals.copy()
            if f.f_globals != f.f_locals:
                ldict.update(f.f_locals)
    
            return ldict

    cxielamiko, 08 Декабря 2011

    Комментарии (10)