%%time magic prevents assignment
See original GitHub issueThe %%time
cell magic is preventing me from binding names. I found this in notebook code on Travis (py 3.6) and reproduced it locally (py 3.7) in notebook and in ipython
at the terminal. It doesn’t seem to apply to all cell magics:
Python 3.7.2 | packaged by conda-forge | (default, Mar 19 2019, 20:46:22)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: %%time
...: foo = "bar"
...:
...:
CPU times: user 3 µs, sys: 0 ns, total: 3 µs
Wall time: 6.91 µs
In [2]: foo
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-2-f1d2d2f924e9> in <module>
----> 1 foo
NameError: name 'foo' is not defined
In [3]: %%prun
...: baz = "qux"
...:
...:
3 function calls in 0.000 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 {built-in method builtins.exec}
1 0.000 0.000 0.000 0.000 <string>:2(<module>)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
In [4]: baz
Out[4]: 'qux'
Confirmed that 7.3.0 worked fine locally.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:39
- Comments:17 (6 by maintainers)
Top Results From Across the Web
time magic funtion prevents variable assigment when used in ...
I'm using IPython version 7.27. The following code snippet throws a NameError: name 'variable' is not defined: def test(msg): %time variable ...
Read more >How to Keep Variable Assignment When Using %%time ...
When I run cells in Jupyter that have the %%time magic function, any variables I assign are not saved. Cell 1: %%time a...
Read more >Combat damage step - MTG Wiki - Fandom
Attacking creatures that are blocked but have the blocking creature removed from combat before the Damage Assignment Step deal no combat damage. Attacking ......
Read more >CR 510. Combat Damage Step - Rules Resources
No player has the chance to cast spells or activate abilities between the time combat damage is assigned and the time it's dealt....
Read more >Administering an Assignment - Capti Voice
Stop Assignment. When you are ready to stop the assignment: Click the Magic Wand button in the top of the sidebar Select Stop...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We’re planning to fix it as soon as we have time; it will likely make it to the 7.5 release that I’ll try to make before end of month.
By the way, in “%%timeit” the situation is exactly the same, but at least it behaves predictably