doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
msg For syntax errors - the compiler error message.
python.library.traceback#traceback.TracebackException.msg
offset For syntax errors - the offset into the text where the error occurred.
python.library.traceback#traceback.TracebackException.offset
stack A StackSummary representing the traceback.
python.library.traceback#traceback.TracebackException.stack
text For syntax errors - the text where the error occurred.
python.library.traceback#traceback.TracebackException.text
__cause__ A TracebackException of the original __cause__.
python.library.traceback#traceback.TracebackException.__cause__
__context__ A TracebackException of the original __context__.
python.library.traceback#traceback.TracebackException.__context__
__suppress_context__ The __suppress_context__ value from the original exception.
python.library.traceback#traceback.TracebackException.__suppress_context__
traceback.walk_stack(f) Walk a stack following f.f_back from the given frame, yielding the frame and line number for each frame. If f is None, the current stack is used. This helper is used with StackSummary.extract(). New in version 3.5.
python.library.traceback#traceback.walk_stack
traceback.walk_tb(tb) Walk a traceback following tb_next yielding the frame and line number for each frame. This helper is used with StackSummary.extract(). New in version 3.5.
python.library.traceback#traceback.walk_tb
tracemalloc — Trace memory allocations New in version 3.4. Source code: Lib/tracemalloc.py The tracemalloc module is a debug tool to trace memory blocks allocated by Python. It provides the following information: Traceback where an object was allocated Statistics on allocated memory blocks per filename and per line ...
python.library.tracemalloc
tracemalloc.clear_traces() Clear traces of memory blocks allocated by Python. See also stop().
python.library.tracemalloc#tracemalloc.clear_traces
class tracemalloc.DomainFilter(inclusive: bool, domain: int) Filter traces of memory blocks by their address space (domain). New in version 3.6. inclusive If inclusive is True (include), match memory blocks allocated in the address space domain. If inclusive is False (exclude), match memory blocks not allocated...
python.library.tracemalloc#tracemalloc.DomainFilter
domain Address space of a memory block (int). Read-only property.
python.library.tracemalloc#tracemalloc.DomainFilter.domain
inclusive If inclusive is True (include), match memory blocks allocated in the address space domain. If inclusive is False (exclude), match memory blocks not allocated in the address space domain.
python.library.tracemalloc#tracemalloc.DomainFilter.inclusive
class tracemalloc.Filter(inclusive: bool, filename_pattern: str, lineno: int=None, all_frames: bool=False, domain: int=None) Filter on traces of memory blocks. See the fnmatch.fnmatch() function for the syntax of filename_pattern. The '.pyc' file extension is replaced with '.py'. Examples: Filter(True, subprocess._...
python.library.tracemalloc#tracemalloc.Filter
all_frames If all_frames is True, all frames of the traceback are checked. If all_frames is False, only the most recent frame is checked. This attribute has no effect if the traceback limit is 1. See the get_traceback_limit() function and Snapshot.traceback_limit attribute.
python.library.tracemalloc#tracemalloc.Filter.all_frames
domain Address space of a memory block (int or None). tracemalloc uses the domain 0 to trace memory allocations made by Python. C extensions can use other domains to trace other resources.
python.library.tracemalloc#tracemalloc.Filter.domain
filename_pattern Filename pattern of the filter (str). Read-only property.
python.library.tracemalloc#tracemalloc.Filter.filename_pattern
inclusive If inclusive is True (include), only match memory blocks allocated in a file with a name matching filename_pattern at line number lineno. If inclusive is False (exclude), ignore memory blocks allocated in a file with a name matching filename_pattern at line number lineno.
python.library.tracemalloc#tracemalloc.Filter.inclusive
lineno Line number (int) of the filter. If lineno is None, the filter matches any line number.
python.library.tracemalloc#tracemalloc.Filter.lineno
class tracemalloc.Frame Frame of a traceback. The Traceback class is a sequence of Frame instances. filename Filename (str). lineno Line number (int).
python.library.tracemalloc#tracemalloc.Frame
filename Filename (str).
python.library.tracemalloc#tracemalloc.Frame.filename
lineno Line number (int).
python.library.tracemalloc#tracemalloc.Frame.lineno
tracemalloc.get_object_traceback(obj) Get the traceback where the Python object obj was allocated. Return a Traceback instance, or None if the tracemalloc module is not tracing memory allocations or did not trace the allocation of the object. See also gc.get_referrers() and sys.getsizeof() functions.
python.library.tracemalloc#tracemalloc.get_object_traceback
tracemalloc.get_traceback_limit() Get the maximum number of frames stored in the traceback of a trace. The tracemalloc module must be tracing memory allocations to get the limit, otherwise an exception is raised. The limit is set by the start() function.
python.library.tracemalloc#tracemalloc.get_traceback_limit
tracemalloc.get_traced_memory() Get the current size and peak size of memory blocks traced by the tracemalloc module as a tuple: (current: int, peak: int).
python.library.tracemalloc#tracemalloc.get_traced_memory
tracemalloc.get_tracemalloc_memory() Get the memory usage in bytes of the tracemalloc module used to store traces of memory blocks. Return an int.
python.library.tracemalloc#tracemalloc.get_tracemalloc_memory
tracemalloc.is_tracing() True if the tracemalloc module is tracing Python memory allocations, False otherwise. See also start() and stop() functions.
python.library.tracemalloc#tracemalloc.is_tracing
tracemalloc.reset_peak() Set the peak size of memory blocks traced by the tracemalloc module to the current size. Do nothing if the tracemalloc module is not tracing memory allocations. This function only modifies the recorded peak size, and does not modify or clear any traces, unlike clear_traces(). Snapshots taken ...
python.library.tracemalloc#tracemalloc.reset_peak
class tracemalloc.Snapshot Snapshot of traces of memory blocks allocated by Python. The take_snapshot() function creates a snapshot instance. compare_to(old_snapshot: Snapshot, key_type: str, cumulative: bool=False) Compute the differences with an old snapshot. Get statistics as a sorted list of StatisticDiff ins...
python.library.tracemalloc#tracemalloc.Snapshot
compare_to(old_snapshot: Snapshot, key_type: str, cumulative: bool=False) Compute the differences with an old snapshot. Get statistics as a sorted list of StatisticDiff instances grouped by key_type. See the Snapshot.statistics() method for key_type and cumulative parameters. The result is sorted from the biggest to ...
python.library.tracemalloc#tracemalloc.Snapshot.compare_to
dump(filename) Write the snapshot into a file. Use load() to reload the snapshot.
python.library.tracemalloc#tracemalloc.Snapshot.dump
filter_traces(filters) Create a new Snapshot instance with a filtered traces sequence, filters is a list of DomainFilter and Filter instances. If filters is an empty list, return a new Snapshot instance with a copy of the traces. All inclusive filters are applied at once, a trace is ignored if no inclusive filters ma...
python.library.tracemalloc#tracemalloc.Snapshot.filter_traces
classmethod load(filename) Load a snapshot from a file. See also dump().
python.library.tracemalloc#tracemalloc.Snapshot.load
statistics(key_type: str, cumulative: bool=False) Get statistics as a sorted list of Statistic instances grouped by key_type: key_type description 'filename' filename 'lineno' filename and line number 'traceback' traceback If cumulative is True, cumulate size and count of memory blocks of all frames of th...
python.library.tracemalloc#tracemalloc.Snapshot.statistics
traceback_limit Maximum number of frames stored in the traceback of traces: result of the get_traceback_limit() when the snapshot was taken.
python.library.tracemalloc#tracemalloc.Snapshot.traceback_limit
traces Traces of all memory blocks allocated by Python: sequence of Trace instances. The sequence has an undefined order. Use the Snapshot.statistics() method to get a sorted list of statistics.
python.library.tracemalloc#tracemalloc.Snapshot.traces
tracemalloc.start(nframe: int=1) Start tracing Python memory allocations: install hooks on Python memory allocators. Collected tracebacks of traces will be limited to nframe frames. By default, a trace of a memory block only stores the most recent frame: the limit is 1. nframe must be greater or equal to 1. You can s...
python.library.tracemalloc#tracemalloc.start
class tracemalloc.Statistic Statistic on memory allocations. Snapshot.statistics() returns a list of Statistic instances. See also the StatisticDiff class. count Number of memory blocks (int). size Total size of memory blocks in bytes (int). traceback Traceback where the memory block was allocated, Tr...
python.library.tracemalloc#tracemalloc.Statistic
count Number of memory blocks (int).
python.library.tracemalloc#tracemalloc.Statistic.count
size Total size of memory blocks in bytes (int).
python.library.tracemalloc#tracemalloc.Statistic.size
traceback Traceback where the memory block was allocated, Traceback instance.
python.library.tracemalloc#tracemalloc.Statistic.traceback
class tracemalloc.StatisticDiff Statistic difference on memory allocations between an old and a new Snapshot instance. Snapshot.compare_to() returns a list of StatisticDiff instances. See also the Statistic class. count Number of memory blocks in the new snapshot (int): 0 if the memory blocks have been released i...
python.library.tracemalloc#tracemalloc.StatisticDiff
count Number of memory blocks in the new snapshot (int): 0 if the memory blocks have been released in the new snapshot.
python.library.tracemalloc#tracemalloc.StatisticDiff.count
count_diff Difference of number of memory blocks between the old and the new snapshots (int): 0 if the memory blocks have been allocated in the new snapshot.
python.library.tracemalloc#tracemalloc.StatisticDiff.count_diff
size Total size of memory blocks in bytes in the new snapshot (int): 0 if the memory blocks have been released in the new snapshot.
python.library.tracemalloc#tracemalloc.StatisticDiff.size
size_diff Difference of total size of memory blocks in bytes between the old and the new snapshots (int): 0 if the memory blocks have been allocated in the new snapshot.
python.library.tracemalloc#tracemalloc.StatisticDiff.size_diff
traceback Traceback where the memory blocks were allocated, Traceback instance.
python.library.tracemalloc#tracemalloc.StatisticDiff.traceback
tracemalloc.stop() Stop tracing Python memory allocations: uninstall hooks on Python memory allocators. Also clears all previously collected traces of memory blocks allocated by Python. Call take_snapshot() function to take a snapshot of traces before clearing them. See also start(), is_tracing() and clear_traces() f...
python.library.tracemalloc#tracemalloc.stop
tracemalloc.take_snapshot() Take a snapshot of traces of memory blocks allocated by Python. Return a new Snapshot instance. The snapshot does not include memory blocks allocated before the tracemalloc module started to trace memory allocations. Tracebacks of traces are limited to get_traceback_limit() frames. Use the...
python.library.tracemalloc#tracemalloc.take_snapshot
class tracemalloc.Trace Trace of a memory block. The Snapshot.traces attribute is a sequence of Trace instances. Changed in version 3.6: Added the domain attribute. domain Address space of a memory block (int). Read-only property. tracemalloc uses the domain 0 to trace memory allocations made by Python. C exten...
python.library.tracemalloc#tracemalloc.Trace
domain Address space of a memory block (int). Read-only property. tracemalloc uses the domain 0 to trace memory allocations made by Python. C extensions can use other domains to trace other resources.
python.library.tracemalloc#tracemalloc.Trace.domain
size Size of the memory block in bytes (int).
python.library.tracemalloc#tracemalloc.Trace.size
traceback Traceback where the memory block was allocated, Traceback instance.
python.library.tracemalloc#tracemalloc.Trace.traceback
class tracemalloc.Traceback Sequence of Frame instances sorted from the oldest frame to the most recent frame. A traceback contains at least 1 frame. If the tracemalloc module failed to get a frame, the filename "<unknown>" at line number 0 is used. When a snapshot is taken, tracebacks of traces are limited to get_tr...
python.library.tracemalloc#tracemalloc.Traceback
format(limit=None, most_recent_first=False) Format the traceback as a list of lines with newlines. Use the linecache module to retrieve lines from the source code. If limit is set, format the limit most recent frames if limit is positive. Otherwise, format the abs(limit) oldest frames. If most_recent_first is True, t...
python.library.tracemalloc#tracemalloc.Traceback.format
total_nframe Total number of frames that composed the traceback before truncation. This attribute can be set to None if the information is not available.
python.library.tracemalloc#tracemalloc.Traceback.total_nframe
True The true value of the bool type. Assignments to True are illegal and raise a SyntaxError.
python.library.constants#True
tty — Terminal control functions Source code: Lib/tty.py The tty module defines functions for putting the tty into cbreak and raw modes. Because it requires the termios module, it will work only on Unix. The tty module defines the following functions: tty.setraw(fd, when=termios.TCSAFLUSH) Change the mode of the fi...
python.library.tty
tty.setcbreak(fd, when=termios.TCSAFLUSH) Change the mode of file descriptor fd to cbreak. If when is omitted, it defaults to termios.TCSAFLUSH, and is passed to termios.tcsetattr().
python.library.tty#tty.setcbreak
tty.setraw(fd, when=termios.TCSAFLUSH) Change the mode of the file descriptor fd to raw. If when is omitted, it defaults to termios.TCSAFLUSH, and is passed to termios.tcsetattr().
python.library.tty#tty.setraw
class tuple([iterable]) Tuples may be constructed in a number of ways: Using a pair of parentheses to denote the empty tuple: () Using a trailing comma for a singleton tuple: a, or (a,) Separating items with commas: a, b, c or (a, b, c) Using the tuple() built-in: tuple() or tuple(iterable) The constructor buil...
python.library.stdtypes#tuple
class tuple([iterable]) Rather than being a function, tuple is actually an immutable sequence type, as documented in Tuples and Sequence Types — list, tuple, range.
python.library.functions#tuple
turtle — Turtle graphics Source code: Lib/turtle.py Introduction Turtle graphics is a popular way for introducing programming to kids. It was part of the original Logo programming language developed by Wally Feurzeig, Seymour Papert and Cynthia Solomon in 1967. Imagine a robotic turtle starting at (0, 0) in the x-y pla...
python.library.turtle
turtle.register_shape(name, shape=None) turtle.addshape(name, shape=None) There are three different ways to call this function: name is the name of a gif-file and shape is None: Install the corresponding image shape. >>> screen.register_shape("turtle.gif") Note Image shapes do not rotate when turning the turtle...
python.library.turtle#turtle.addshape
turtle.back(distance) turtle.bk(distance) turtle.backward(distance) Parameters distance – a number Move the turtle backward by distance, opposite to the direction the turtle is headed. Do not change the turtle’s heading. >>> turtle.position() (0.00,0.00) >>> turtle.backward(30) >>> turtle.position() (-30.00,0...
python.library.turtle#turtle.back
turtle.back(distance) turtle.bk(distance) turtle.backward(distance) Parameters distance – a number Move the turtle backward by distance, opposite to the direction the turtle is headed. Do not change the turtle’s heading. >>> turtle.position() (0.00,0.00) >>> turtle.backward(30) >>> turtle.position() (-30.00,0...
python.library.turtle#turtle.backward
turtle.begin_fill() To be called just before drawing a shape to be filled.
python.library.turtle#turtle.begin_fill
turtle.begin_poly() Start recording the vertices of a polygon. Current turtle position is first vertex of polygon.
python.library.turtle#turtle.begin_poly
turtle.bgcolor(*args) Parameters args – a color string or three numbers in the range 0..colormode or a 3-tuple of such numbers Set or return background color of the TurtleScreen. >>> screen.bgcolor("orange") >>> screen.bgcolor() 'orange' >>> screen.bgcolor("#800080") >>> screen.bgcolor() (128.0, 0.0, 128.0)
python.library.turtle#turtle.bgcolor
turtle.bgpic(picname=None) Parameters picname – a string, name of a gif-file or "nopic", or None Set background image or return name of current backgroundimage. If picname is a filename, set the corresponding image as background. If picname is "nopic", delete background image, if present. If picname is None, retu...
python.library.turtle#turtle.bgpic
turtle.back(distance) turtle.bk(distance) turtle.backward(distance) Parameters distance – a number Move the turtle backward by distance, opposite to the direction the turtle is headed. Do not change the turtle’s heading. >>> turtle.position() (0.00,0.00) >>> turtle.backward(30) >>> turtle.position() (-30.00,0...
python.library.turtle#turtle.bk
turtle.bye() Shut the turtlegraphics window.
python.library.turtle#turtle.bye
turtle.circle(radius, extent=None, steps=None) Parameters radius – a number extent – a number (or None) steps – an integer (or None) Draw a circle with given radius. The center is radius units left of the turtle; extent – an angle – determines which part of the circle is drawn. If extent is not given, draw t...
python.library.turtle#turtle.circle
turtle.clear() turtle.clearscreen() Delete all drawings and all turtles from the TurtleScreen. Reset the now empty TurtleScreen to its initial state: white background, no background image, no event bindings and tracing on. Note This TurtleScreen method is available as a global function only under the name clearscr...
python.library.turtle#turtle.clear
turtle.clear() turtle.clearscreen() Delete all drawings and all turtles from the TurtleScreen. Reset the now empty TurtleScreen to its initial state: white background, no background image, no event bindings and tracing on. Note This TurtleScreen method is available as a global function only under the name clearscr...
python.library.turtle#turtle.clearscreen
turtle.clearstamp(stampid) Parameters stampid – an integer, must be return value of previous stamp() call Delete stamp with given stampid. >>> turtle.position() (150.00,-0.00) >>> turtle.color("blue") >>> astamp = turtle.stamp() >>> turtle.fd(50) >>> turtle.position() (200.00,-0.00) >>> turtle.clearstamp(astamp) ...
python.library.turtle#turtle.clearstamp
turtle.clearstamps(n=None) Parameters n – an integer (or None) Delete all or first/last n of turtle’s stamps. If n is None, delete all stamps, if n > 0 delete first n stamps, else if n < 0 delete last n stamps. >>> for i in range(8): ... turtle.stamp(); turtle.fd(30) 13 14 15 16 17 18 19 20 >>> turtle.clearst...
python.library.turtle#turtle.clearstamps
turtle.clone() Create and return a clone of the turtle with same position, heading and turtle properties. >>> mick = Turtle() >>> joe = mick.clone()
python.library.turtle#turtle.clone
turtle.color(*args) Return or set pencolor and fillcolor. Several input formats are allowed. They use 0 to 3 arguments as follows: color() Return the current pencolor and the current fillcolor as a pair of color specification strings or tuples as returned by pencolor() and fillcolor(). color(colorstring), color...
python.library.turtle#turtle.color
turtle.colormode(cmode=None) Parameters cmode – one of the values 1.0 or 255 Return the colormode or set it to 1.0 or 255. Subsequently r, g, b values of color triples have to be in the range 0..cmode. >>> screen.colormode(1) >>> turtle.pencolor(240, 160, 80) Traceback (most recent call last): ... TurtleGrap...
python.library.turtle#turtle.colormode
turtle.degrees(fullcircle=360.0) Parameters fullcircle – a number Set angle measurement units, i.e. set number of “degrees” for a full circle. Default value is 360 degrees. >>> turtle.home() >>> turtle.left(90) >>> turtle.heading() 90.0 Change angle measurement unit to grad (also known as gon, grade, or gradian ...
python.library.turtle#turtle.degrees
turtle.delay(delay=None) Parameters delay – positive integer Set or return the drawing delay in milliseconds. (This is approximately the time interval between two consecutive canvas updates.) The longer the drawing delay, the slower the animation. Optional argument: >>> screen.delay() 10 >>> screen.delay(5) >>> s...
python.library.turtle#turtle.delay
turtle.distance(x, y=None) Parameters x – a number or a pair/vector of numbers or a turtle instance y – a number if x is a number, else None Return the distance from the turtle to (x,y), the given vector, or the given other turtle, in turtle step units. >>> turtle.home() >>> turtle.distance(30,40) 50.0 >>> t...
python.library.turtle#turtle.distance
turtle.mainloop() turtle.done() Starts event loop - calling Tkinter’s mainloop function. Must be the last statement in a turtle graphics program. Must not be used if a script is run from within IDLE in -n mode (No subprocess) - for interactive use of turtle graphics. >>> screen.mainloop()
python.library.turtle#turtle.done
turtle.dot(size=None, *color) Parameters size – an integer >= 1 (if given) color – a colorstring or a numeric color tuple Draw a circular dot with diameter size, using color. If size is not given, the maximum of pensize+4 and 2*pensize is used. >>> turtle.home() >>> turtle.dot() >>> turtle.fd(50); turtle.dot(...
python.library.turtle#turtle.dot
turtle.pendown() turtle.pd() turtle.down() Pull the pen down – drawing when moving.
python.library.turtle#turtle.down
turtle.end_fill() Fill the shape drawn after the last call to begin_fill(). Whether or not overlap regions for self-intersecting polygons or multiple shapes are filled depends on the operating system graphics, type of overlap, and number of overlaps. For example, the Turtle star above may be either all yellow or have...
python.library.turtle#turtle.end_fill
turtle.end_poly() Stop recording the vertices of a polygon. Current turtle position is last vertex of polygon. This will be connected with the first vertex.
python.library.turtle#turtle.end_poly
turtle.exitonclick() Bind bye() method to mouse clicks on the Screen. If the value “using_IDLE” in the configuration dictionary is False (default value), also enter mainloop. Remark: If IDLE with the -n switch (no subprocess) is used, this value should be set to True in turtle.cfg. In this case IDLE’s own mainloop is...
python.library.turtle#turtle.exitonclick
turtle.forward(distance) turtle.fd(distance) Parameters distance – a number (integer or float) Move the turtle forward by the specified distance, in the direction the turtle is headed. >>> turtle.position() (0.00,0.00) >>> turtle.forward(25) >>> turtle.position() (25.00,0.00) >>> turtle.forward(-75) >>> turtle....
python.library.turtle#turtle.fd
turtle.fillcolor(*args) Return or set the fillcolor. Four input formats are allowed: fillcolor() Return the current fillcolor as color specification string, possibly in tuple format (see example). May be used as input to another color/pencolor/fillcolor call. fillcolor(colorstring) Set fillcolor to colorstrin...
python.library.turtle#turtle.fillcolor
turtle.filling() Return fillstate (True if filling, False else). >>> turtle.begin_fill() >>> if turtle.filling(): ... turtle.pensize(5) ... else: ... turtle.pensize(3)
python.library.turtle#turtle.filling
turtle.forward(distance) turtle.fd(distance) Parameters distance – a number (integer or float) Move the turtle forward by the specified distance, in the direction the turtle is headed. >>> turtle.position() (0.00,0.00) >>> turtle.forward(25) >>> turtle.position() (25.00,0.00) >>> turtle.forward(-75) >>> turtle....
python.library.turtle#turtle.forward
turtle.getcanvas() Return the Canvas of this TurtleScreen. Useful for insiders who know what to do with a Tkinter Canvas. >>> cv = screen.getcanvas() >>> cv <turtle.ScrolledCanvas object ...>
python.library.turtle#turtle.getcanvas
turtle.getturtle() turtle.getpen() Return the Turtle object itself. Only reasonable use: as a function to return the “anonymous turtle”: >>> pet = getturtle() >>> pet.fd(50) >>> pet <turtle.Turtle object at 0x...>
python.library.turtle#turtle.getpen
turtle.getscreen() Return the TurtleScreen object the turtle is drawing on. TurtleScreen methods can then be called for that object. >>> ts = turtle.getscreen() >>> ts <turtle._Screen object at 0x...> >>> ts.bgcolor("pink")
python.library.turtle#turtle.getscreen
turtle.getshapes() Return a list of names of all currently available turtle shapes. >>> screen.getshapes() ['arrow', 'blank', 'circle', ..., 'turtle']
python.library.turtle#turtle.getshapes
turtle.getturtle() turtle.getpen() Return the Turtle object itself. Only reasonable use: as a function to return the “anonymous turtle”: >>> pet = getturtle() >>> pet.fd(50) >>> pet <turtle.Turtle object at 0x...>
python.library.turtle#turtle.getturtle
turtle.get_poly() Return the last recorded polygon. >>> turtle.home() >>> turtle.begin_poly() >>> turtle.fd(100) >>> turtle.left(20) >>> turtle.fd(30) >>> turtle.left(60) >>> turtle.fd(50) >>> turtle.end_poly() >>> p = turtle.get_poly() >>> register_shape("myFavouriteShape", p)
python.library.turtle#turtle.get_poly