Example #1
0
def get():
    """Get the most recently created InteractiveShell instance."""
    from IPython.core.iplib import InteractiveShell
    insts = InteractiveShell.get_instances()
    most_recent = insts[0]
    for inst in insts[1:]:
        if inst.created > most_recent.created:
            most_recent = inst
    return most_recent
Example #2
0
def get():
    """Get the most recently created InteractiveShell instance."""
    from IPython.core.iplib import InteractiveShell
    insts = InteractiveShell.get_instances()
    if len(insts)==0:
        return None
    most_recent = insts[0]
    for inst in insts[1:]:
        if inst.created > most_recent.created:
            most_recent = inst
    return most_recent