Show More
@@ -18,16 +18,19 b' has been made into a component, this module will be sent to deathrow.' | |||||
18 | # Imports |
|
18 | # Imports | |
19 | #----------------------------------------------------------------------------- |
|
19 | #----------------------------------------------------------------------------- | |
20 |
|
20 | |||
21 | from IPython.core.error import TryNext, UsageError |
|
21 | from IPython.core.error import TryNext, UsageError, IPythonCoreError | |
22 |
|
22 | |||
23 | #----------------------------------------------------------------------------- |
|
23 | #----------------------------------------------------------------------------- | |
24 | # Classes and functions |
|
24 | # Classes and functions | |
25 | #----------------------------------------------------------------------------- |
|
25 | #----------------------------------------------------------------------------- | |
26 |
|
26 | |||
|
27 | ||||
27 | def get(): |
|
28 | def get(): | |
28 | """Get the most recently created InteractiveShell instance.""" |
|
29 | """Get the most recently created InteractiveShell instance.""" | |
29 | from IPython.core.iplib import InteractiveShell |
|
30 | from IPython.core.iplib import InteractiveShell | |
30 | insts = InteractiveShell.get_instances() |
|
31 | insts = InteractiveShell.get_instances() | |
|
32 | if len(insts)==0: | |||
|
33 | return None | |||
31 | most_recent = insts[0] |
|
34 | most_recent = insts[0] | |
32 | for inst in insts[1:]: |
|
35 | for inst in insts[1:]: | |
33 | if inst.created > most_recent.created: |
|
36 | if inst.created > most_recent.created: |
General Comments 0
You need to be logged in to leave comments.
Login now