From a82908f7433a4c8050ca9189529a1a9978d136a5 Mon Sep 17 00:00:00 2001 From: Senthil Kumaran Date: Fri, 15 Jan 2016 21:45:17 -0800 Subject: Issue26035 - Correct the argument names used in the docs of the traceback module. Make it consistent with module args. Patch contributed by Upendra Kumar. --- Doc/library/traceback.rst | 69 ++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst index 8d216d0..5459daa 100644 --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -20,29 +20,29 @@ the :data:`sys.last_traceback` variable and returned as the third item from The module defines the following functions: -.. function:: print_tb(traceback, limit=None, file=None) +.. function:: print_tb(tb, limit=None, file=None) - Print up to *limit* stack trace entries from *traceback* (starting from - the caller's frame) if *limit* is positive. Otherwise, print the last - ``abs(limit)`` entries. If *limit* is omitted or ``None``, all entries - are printed. If *file* is omitted or ``None``, the output goes to - ``sys.stderr``; otherwise it should be an open file or file-like object - to receive the output. + Print up to *limit* stack trace entries from traceback object *tb* (starting + from the caller's frame) if *limit* is positive. Otherwise, print the last + ``abs(limit)`` entries. If *limit* is omitted or ``None``, all entries are + printed. If *file* is omitted or ``None``, the output goes to + ``sys.stderr``; otherwise it should be an open file or file-like object to + receive the output. .. versionchanged:: 3.5 Added negative *limit* support. -.. function:: print_exception(type, value, traceback, limit=None, file=None, chain=True) +.. function:: print_exception(etype, value, tb, limit=None, file=None, chain=True) - Print exception information and stack trace entries from - *traceback* to *file*. This differs from :func:`print_tb` in the following + Print exception information and stack trace entries from traceback object + *tb* to *file*. This differs from :func:`print_tb` in the following ways: - * if *traceback* is not ``None``, it prints a header ``Traceback (most recent + * if *tb* is not ``None``, it prints a header ``Traceback (most recent call last):`` - * it prints the exception *type* and *value* after the stack trace - * if *type* is :exc:`SyntaxError` and *value* has the appropriate format, it + * it prints the exception *etype* and *value* after the stack trace + * if *etype* is :exc:`SyntaxError` and *value* has the appropriate format, it prints the line where the syntax error occurred with a caret indicating the approximate position of the error. @@ -80,10 +80,10 @@ The module defines the following functions: Added negative *limit* support. -.. function:: extract_tb(traceback, limit=None) +.. function:: extract_tb(tb, limit=None) Return a list of "pre-processed" stack trace entries extracted from the - traceback object *traceback*. It is useful for alternate formatting of + traceback object *tb*. It is useful for alternate formatting of stack traces. The optional *limit* argument has the same meaning as for :func:`print_tb`. A "pre-processed" stack trace entry is a 4-tuple (*filename*, *line number*, *function name*, *text*) representing the @@ -99,39 +99,40 @@ The module defines the following functions: arguments have the same meaning as for :func:`print_stack`. -.. function:: format_list(list) +.. function:: format_list(extracted_list) Given a list of tuples as returned by :func:`extract_tb` or - :func:`extract_stack`, return a list of strings ready for printing. Each string - in the resulting list corresponds to the item with the same index in the - argument list. Each string ends in a newline; the strings may contain internal - newlines as well, for those items whose source text line is not ``None``. + :func:`extract_stack`, return a list of strings ready for printing. Each + string in the resulting list corresponds to the item with the same index in + the argument list. Each string ends in a newline; the strings may contain + internal newlines as well, for those items whose source text line is not + ``None``. -.. function:: format_exception_only(type, value) +.. function:: format_exception_only(etype, value) - Format the exception part of a traceback. The arguments are the exception type - and value such as given by ``sys.last_type`` and ``sys.last_value``. The return - value is a list of strings, each ending in a newline. Normally, the list - contains a single string; however, for :exc:`SyntaxError` exceptions, it - contains several lines that (when printed) display detailed information about - where the syntax error occurred. The message indicating which exception - occurred is the always last string in the list. + Format the exception part of a traceback. The arguments are the exception + type and value such as given by ``sys.last_type`` and ``sys.last_value``. + The return value is a list of strings, each ending in a newline. Normally, + the list contains a single string; however, for :exc:`SyntaxError` + exceptions, it contains several lines that (when printed) display detailed + information about where the syntax error occurred. The message indicating + which exception occurred is the always last string in the list. -.. function:: format_exception(type, value, tb, limit=None, chain=True) +.. function:: format_exception(etype, value, tb, limit=None, chain=True) Format a stack trace and the exception information. The arguments have the same meaning as the corresponding arguments to :func:`print_exception`. The - return value is a list of strings, each ending in a newline and some containing - internal newlines. When these lines are concatenated and printed, exactly the - same text is printed as does :func:`print_exception`. + return value is a list of strings, each ending in a newline and some + containing internal newlines. When these lines are concatenated and printed, + exactly the same text is printed as does :func:`print_exception`. .. function:: format_exc(limit=None, chain=True) - This is like ``print_exc(limit)`` but returns a string instead of printing to a - file. + This is like ``print_exc(limit)`` but returns a string instead of printing to + a file. .. function:: format_tb(tb, limit=None) -- cgit v0.12 75 Tcl is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful.
summaryrefslogtreecommitdiffstats
path: root/doc/break.n
blob: ed09c03f5e084801bba154a1e2de0c305a1029ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'\"
'\" Copyright (c) 1993-1994 The Regents of the University of California.
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
'\"
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\" 
.so man.macros
.TH break n "" Tcl "Tcl Built-In Commands"
.BS
'\" Note:  do not modify the .SH NAME line immediately below!
.SH NAME
break \- Abort looping command
.SH SYNOPSIS
\fBbreak\fR
.BE

.SH DESCRIPTION
.PP
This command is typically invoked inside the body of a looping command
such as \fBfor\fR or \fBforeach\fR or \fBwhile\fR.
It returns a \fBTCL_BREAK\fR code, which causes a break exception
to occur.
The exception causes the current script to be aborted
out to the innermost containing loop command, which then
aborts its execution and returns normally.
Break exceptions are also handled in a few other situations, such
as the \fBcatch\fR command, Tk event bindings, and the outermost
scripts of procedure bodies.
.SH EXAMPLE
Print a line for each of the integers from 0 to 5:
.CS
for {set x 0} {$x<10} {incr x} {
   if {$x > 5} {
      \fBbreak\fR
   }
   puts "x is $x"
}
.CE

.SH "SEE ALSO"
catch(n), continue(n), for(n), foreach(n), return(n), while(n)

.SH KEYWORDS
abort, break, loop