Quick actions

cmd+k|ctrl+k

Navigation

Languages

20240405 1031

Snippet info

Language

Python

Visibility

public

Author

hkchun

Created

2024-04-05T02:24:38.760671Z

Updated

2024-04-05T03:42:41.915718Z

import dis
def fib1(n):
    if n < 2:
       return n
    current, next = 0,1
    while n:
        current, next = next, current + next
        n -= 1
    return current
    
print(fib1.__code__)
print(fib1.__code__.co_consts)
print(fib1.__code__.co_names)  
print(fib1.__code__.co_code)
dis.dis(fib1)
INFO