Author: georg.brandl
Date: Tue Sep  4 09:07:56 2007
New Revision: 57949

Modified:
   python/branches/py3k/Doc/library/pdb.rst
   python/branches/py3k/Lib/pdb.py
Log:
Add "print" command to pdb, "print s" previously invoked the print statement.


Modified: python/branches/py3k/Doc/library/pdb.rst
==============================================================================
--- python/branches/py3k/Doc/library/pdb.rst    (original)
+++ python/branches/py3k/Doc/library/pdb.rst    Tue Sep  4 09:07:56 2007
@@ -61,11 +61,11 @@
      File "./mymodule.py", line 4, in test
        test2()
      File "./mymodule.py", line 3, in test2
-       print spam
+       print(spam)
    NameError: spam
    >>> pdb.pm()
    > ./mymodule.py(3)test2()
-   -> print spam
+   -> print(spam)
    (Pdb) 
 
 The module defines the following functions; each enters the debugger in a
@@ -283,14 +283,9 @@
 a(rgs)
    Print the argument list of the current function.
 
-p *expression*
+p(rint) *expression*
    Evaluate the *expression* in the current context and print its value.
 
-   .. note::
-
-      ``print`` can also be used, but is not a debugger command --- this 
executes the
-      Python :keyword:`print` statement.
-
 pp *expression*
    Like the ``p`` command, except the value of the expression is pretty-printed
    using the :mod:`pprint` module.
@@ -312,7 +307,7 @@
    :file:`.pdbrc` file)::
 
       #Print instance variables (usage "pi classInst")
-      alias pi for k in %1.__dict__.keys(): print "%1.",k,"=",%1.__dict__[k]
+      alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k])
       #Print instance variables in self
       alias ps pi self
 

Modified: python/branches/py3k/Lib/pdb.py
==============================================================================
--- python/branches/py3k/Lib/pdb.py     (original)
+++ python/branches/py3k/Lib/pdb.py     Tue Sep  4 09:07:56 2007
@@ -716,6 +716,8 @@
             print(repr(self._getval(arg)), file=self.stdout)
         except:
             pass
+    # make "print" an alias of "p" since print isn't a Python statement anymore
+    do_print = do_p
 
     def do_pp(self, arg):
         try:
@@ -1009,7 +1011,7 @@
 Print the arguments of the current function.""", file=self.stdout)
 
     def help_p(self):
-        print("""p expression
+        print("""p(rint) expression
 Print the value of the expression.""", file=self.stdout)
 
     def help_pp(self):
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to