Rock It 《ML》JupyterLab 【丁】Code《六》後

如果說派生之『標識符』未綁定『物件』前,不能存在、沒有意指 ,那麼在『函式』定義時,只能是『形式參數』 formal parameter乎?因為所指『物件』是什麼『東東』未知也!所以我們能寫如下合乎『語法』的『兩倍』 function 哩!!

 

然則『兩倍』不就可『加倍』嗎??一時打字之不小心,恐怕必須要『除錯』呦☻

 

因此早已有

27.3. pdbThe Python Debugger

Source code: Lib/pdb.py


The module pdb defines an interactive source code debugger for Python programs. It supports setting (conditional) breakpoints and single stepping at the source line level, inspection of stack frames, source code listing, and evaluation of arbitrary Python code in the context of any stack frame. It also supports post-mortem debugging and can be called under program control.

The debugger is extensible – it is actually defined as the class Pdb. This is currently undocumented but easily understood by reading the source. The extension interface uses the modules bdb and cmd.

The debugger’s prompt is (Pdb). Typical usage to run a program under control of the debugger is:

>>> import pdb
>>> import mymodule
>>> pdb.run('mymodule.test()')
> <string>(0)?()
(Pdb) continue
> <string>(1)?()
(Pdb) continue
NameError: 'spam'
> <string>(1)?()
(Pdb)

Changed in version 3.3: Tab-completion via the readline module is available for commands and command arguments, e.g. the current global and local names are offered as arguments of the p command.

耶?讀者最好先知道其『用法』也。

為何呢?由於少有『說明』文件,通常不過借其『擴張』功能;

務須知 h(elp)) 以及 ?(cmd) 簡潔字句也☺

 

特介紹

/ipdb

Integration of IPython pdb

IPython pdb

https://travis-ci.org/gotcha/ipdb.png?branch=master

Use

ipdb exports functions to access the IPython debugger, which features tab completion, syntax highlighting, better tracebacks, better introspection with the same interface as the pdb module.

Example usage:

import ipdb
ipdb.set_trace()
ipdb.set_trace(context=5)  # will show five lines of code
                           # instead of the default three lines
ipdb.pm()
ipdb.run('x[0] = 3')
result = ipdb.runcall(function, arg0, arg1, kwarg='foo')
result = ipdb.runeval('f(1,2) - 3')

 

強調與 Jupyter Lab 介面之相容性哩︰

 

就像 JupyterLab 不可用

PixieDebugger – A Visual Python Debugger for Jupyter Notebooks Every Data Scientist Should Use

Overview

  • PixieDebugger is a powerful visual debugger for Python that works in Jupyter Notebooks
  • It comes with multiple features, including a source editor and a code execution controlling toolbar
  • It works as a magic command and requires PixieDust as a prerequisite

Introduction

Picture this – you think you’ve designed a phenomenal model using tons of lines of code but there’s a pesky error in there. It’s holding back the model from achieving it’s full power but you can’t quite figure out what’s wrong. Sure, you could use Jupyter’s pdb but wouldn’t it be awesome to visually debug that code block within an interactive environment? I’ve got some awesome news for you!

PixieDebugger, developed by the PixieDust team, claims to be the first visual debugger for Python that works exclusively with Jupyter Notebooks. Note that it doesn’t yet work with JupyterLab but the developers might be working on fixing this soon. The PixieDebugger comes packaged with multiple features, including:

  • A source editor
  • Console output feature
  • Local variable inspector
  • Breakpoint management
  • Code execution controlling toolbar

 

但『筆記本』可用勒☆