ericpjOU / dvp-u3-constellations

0 stars 0 forks source link

Interesting import statement #1

Open jmcrey opened 6 years ago

jmcrey commented 6 years ago

https://github.com/ericpjOU/dvp-u3-constellations/blob/4d4318d5a7cff4dc375796ae7fb19e28ca02c639/SavedNotebooksForSubmission/EricJacobsen_constellation.py#L33

I have never seen this package imported this way; really cool that you found this! I just wanted to note a couple alternatives we can do to achieve the same effect. If we want to stick with get_ipython(), we can use the function run_line_magic(). So, it'll look like this:

get_ipython().run_line_magic('matplotlib', 'notebook')

I suspect that this function will eventually call the magic() function similar to how you have it above, but I have no proof -- just a hunch. Another way to import the package is the use the native ipython operater %. That will look like:

%matplotlib notebook

Functionally, there is no difference between any of these import statements. Honestly, I don't know if there are any differences in terms of performance either; so, really, it's just preference to which one you use.

Either way, nice job finding this! It's really cool!