λλ SOμ λ¬Όμκ³ μ¬κΈ°μμ μ¬νν©λλ€. λ κ°μ μ μ΄ μλ λ ΈνΈλΆ:
[1]μμ
import numpy as np
import matplotlib.pyplot as plt
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all";
[2]μμ
%matplotlib inline
data ={'first':np.random.rand(100),
'second':np.random.rand(100)}
fig, axes = plt.subplots(2)
for idx, k in enumerate(data):
axes[idx].hist(data[k], bins=20);
plt.hist()
μ μΆλ ₯μ μ΅μ νμ§ μμ΅λλ€.
νμ΄μ¬μμ μΆλ ₯ -c "import IPython; print(IPython.sys_info())"
{'commit_hash': 'd86648c5d',
'commit_source': 'installation',
'default_encoding': 'UTF-8',
'ipython_path': '/Users/okomarov/anaconda/lib/python3.6/site-packages/IPython',
'ipython_version': '6.1.0',
'os_name': 'posix',
'platform': 'Darwin-16.7.0-x86_64-i386-64bit',
'sys_executable': '/Users/okomarov/anaconda/bin/python3',
'sys_platform': 'darwin',
'sys_version': '3.6.2 |Anaconda custom (x86_64)| (default, Jul 20 2017, '
'13:14:59) \n'
'[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]'}
InteractiveShell.ast_node_interactivity = "all";
μ€μ νμΌλ―λ‘ λͺ¨λ λ
Έλκ° ast μνΈ μμ©μ νμ±ννλλ‘ μ€μ νμ΅λλ€.
κ·Έλ¦¬κ³ ;
λ λ§μ§λ§ μ΅μμ ννμμ λν΄μλ§ μλν©λλ€. axes[idx].hist(data[k], bins=20);
λ for
μ€μ²©λμ΄ μμΌλ―λ‘ μ΅μμ λ λ²¨μ΄ μλλλ€. λ§μ§λ§ μ΅μμ λ
Έλμ κ²½μ° for
, μ΄κ²μ λͺ
λ Ήλ¬Έμ
λλ€.
λ§μ§λ§ no-op λ¬Έμ μΆκ°νκ³ ;
λλ
λλ€.
%matplotlib inline
data ={'first':np.random.rand(100),
'second':np.random.rand(100)};
fig, axes = plt.subplots(2);
for idx, k in enumerate(data):
axes[idx].hist(data[k], bins=20)
pass;
κ·Έλ¦¬κ³ λΉμ μ μ΄λ€ μΆλ ₯λ κ°μ§ μμ κ²μ λλ€.
@Carreau μ€λͺ κ°μ¬ν©λλ€!
λ€μμ λν΄ μ°Ύμ μ μμ΅λλ€.
κ·Έλ¦¬κ³ ; λ§μ§λ§ μ΅μμ ννμμ λν΄μλ§ μλν©λλ€.
μ΄λκ°μ λ¬Έμνλμ΄ μμ΅λκΉ? λ΄κ° μλ½ν μ μλλ‘ λ΅λ³μ 볡μ¬νμ¬ SOμ λΆμ¬λ£μΌμκ² μ΅λκΉ?
μ΄λκ°μ λ¬Έμνλμ΄ μμ΅λκΉ?
μλ§λ κ·Έλ μ§ μμ κ²μ
λλ€. ast_interactivity
μ΅μ
μ κ±°μ μ¬μ©λμ§ μμΌλ―λ‘ _λλΆλΆμ_ μ¬μ© μ¬λ‘λ λ§μ§λ§ ννμμλ§ μ μ©λλ―λ‘ κ΅¬λΆμ μ κ²½μ°μ§ μμ΅λλ€.
λ΄κ° μλ½ν μ μλλ‘ λ΅λ³μ 볡μ¬νμ¬ λΆμ¬λ£μΌμκ² μ΅λκΉ?
λͺ κ°μ§ λ€λ₯Έ μΈλΆ μ¬νκ³Ό ν¨κ» μ΄λ―Έ νμ΅λλ€ :-)
κ°μ₯ μ μ©ν λκΈ
InteractiveShell.ast_node_interactivity = "all";
μ€μ νμΌλ―λ‘ λͺ¨λ λ Έλκ° ast μνΈ μμ©μ νμ±ννλλ‘ μ€μ νμ΅λλ€.그리κ³
;
λ λ§μ§λ§ μ΅μμ ννμμ λν΄μλ§ μλν©λλ€.axes[idx].hist(data[k], bins=20);
λfor
μ€μ²©λμ΄ μμΌλ―λ‘ μ΅μμ λ λ²¨μ΄ μλλλ€. λ§μ§λ§ μ΅μμ λ Έλμ κ²½μ°for
, μ΄κ²μ λͺ λ Ήλ¬Έμ λλ€.λ§μ§λ§ no-op λ¬Έμ μΆκ°νκ³
;
λλ λλ€.κ·Έλ¦¬κ³ λΉμ μ μ΄λ€ μΆλ ₯λ κ°μ§ μμ κ²μ λλ€.