doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
turtle.get_shapepoly() Return the current shape polygon as tuple of coordinate pairs. This can be used to define a new shape or components of a compound shape. >>> turtle.shape("square") >>> turtle.shapetransform(4, -1, 0, 2) >>> turtle.get_shapepoly() ((50, -20), (30, 20), (-50, 20), (-30, -20))
python.library.turtle#turtle.get_shapepoly
turtle.goto(x, y=None) turtle.setpos(x, y=None) turtle.setposition(x, y=None) Parameters x – a number or a pair/vector of numbers y – a number or None If y is None, x must be a pair of coordinates or a Vec2D (e.g. as returned by pos()). Move turtle to an absolute position. If the pen is down, draw line. ...
python.library.turtle#turtle.goto
turtle.heading() Return the turtle’s current heading (value depends on the turtle mode, see mode()). >>> turtle.home() >>> turtle.left(67) >>> turtle.heading() 67.0
python.library.turtle#turtle.heading
turtle.hideturtle() turtle.ht() Make the turtle invisible. It’s a good idea to do this while you’re in the middle of doing some complex drawing, because hiding the turtle speeds up the drawing observably. >>> turtle.hideturtle()
python.library.turtle#turtle.hideturtle
turtle.home() Move turtle to the origin – coordinates (0,0) – and set its heading to its start-orientation (which depends on the mode, see mode()). >>> turtle.heading() 90.0 >>> turtle.position() (0.00,-10.00) >>> turtle.home() >>> turtle.position() (0.00,0.00) >>> turtle.heading() 0.0
python.library.turtle#turtle.home
turtle.hideturtle() turtle.ht() Make the turtle invisible. It’s a good idea to do this while you’re in the middle of doing some complex drawing, because hiding the turtle speeds up the drawing observably. >>> turtle.hideturtle()
python.library.turtle#turtle.ht
turtle.isdown() Return True if pen is down, False if it’s up. >>> turtle.penup() >>> turtle.isdown() False >>> turtle.pendown() >>> turtle.isdown() True
python.library.turtle#turtle.isdown
turtle.isvisible() Return True if the Turtle is shown, False if it’s hidden. >>> turtle.hideturtle() >>> turtle.isvisible() False >>> turtle.showturtle() >>> turtle.isvisible() True
python.library.turtle#turtle.isvisible
turtle.left(angle) turtle.lt(angle) Parameters angle – a number (integer or float) Turn turtle left by angle units. (Units are by default degrees, but can be set via the degrees() and radians() functions.) Angle orientation depends on the turtle mode, see mode(). >>> turtle.heading() 22.0 >>> turtle.left(45) >>...
python.library.turtle#turtle.left
turtle.listen(xdummy=None, ydummy=None) Set focus on TurtleScreen (in order to collect key-events). Dummy arguments are provided in order to be able to pass listen() to the onclick method.
python.library.turtle#turtle.listen
turtle.left(angle) turtle.lt(angle) Parameters angle – a number (integer or float) Turn turtle left by angle units. (Units are by default degrees, but can be set via the degrees() and radians() functions.) Angle orientation depends on the turtle mode, see mode(). >>> turtle.heading() 22.0 >>> turtle.left(45) >>...
python.library.turtle#turtle.lt
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.mainloop
turtle.mode(mode=None) Parameters mode – one of the strings “standard”, “logo” or “world” Set turtle mode (“standard”, “logo” or “world”) and perform reset. If mode is not given, current mode is returned. Mode “standard” is compatible with old turtle. Mode “logo” is compatible with most Logo turtle graphics. Mode...
python.library.turtle#turtle.mode
turtle.numinput(title, prompt, default=None, minval=None, maxval=None) Parameters title – string prompt – string default – number (optional) minval – number (optional) maxval – number (optional) Pop up a dialog window for input of a number. title is the title of the dialog window, prompt is a text mostly d...
python.library.turtle#turtle.numinput
turtle.onclick(fun, btn=1, add=None) turtle.onscreenclick(fun, btn=1, add=None) Parameters fun – a function with two arguments which will be called with the coordinates of the clicked point on the canvas btn – number of the mouse-button, defaults to 1 (left mouse button) add – True or False – if True, a new b...
python.library.turtle#turtle.onclick
turtle.ondrag(fun, btn=1, add=None) Parameters fun – a function with two arguments which will be called with the coordinates of the clicked point on the canvas btn – number of the mouse-button, defaults to 1 (left mouse button) add – True or False – if True, a new binding will be added, otherwise it will replac...
python.library.turtle#turtle.ondrag
turtle.onkey(fun, key) turtle.onkeyrelease(fun, key) Parameters fun – a function with no arguments or None key – a string: key (e.g. “a”) or key-symbol (e.g. “space”) Bind fun to key-release event of key. If fun is None, event bindings are removed. Remark: in order to be able to register key-events, Turtle...
python.library.turtle#turtle.onkey
turtle.onkeypress(fun, key=None) Parameters fun – a function with no arguments or None key – a string: key (e.g. “a”) or key-symbol (e.g. “space”) Bind fun to key-press event of key if key is given, or to any key-press-event if no key is given. Remark: in order to be able to register key-events, TurtleScreen...
python.library.turtle#turtle.onkeypress
turtle.onkey(fun, key) turtle.onkeyrelease(fun, key) Parameters fun – a function with no arguments or None key – a string: key (e.g. “a”) or key-symbol (e.g. “space”) Bind fun to key-release event of key. If fun is None, event bindings are removed. Remark: in order to be able to register key-events, Turtle...
python.library.turtle#turtle.onkeyrelease
turtle.onrelease(fun, btn=1, add=None) Parameters fun – a function with two arguments which will be called with the coordinates of the clicked point on the canvas btn – number of the mouse-button, defaults to 1 (left mouse button) add – True or False – if True, a new binding will be added, otherwise it will rep...
python.library.turtle#turtle.onrelease
turtle.onclick(fun, btn=1, add=None) turtle.onscreenclick(fun, btn=1, add=None) Parameters fun – a function with two arguments which will be called with the coordinates of the clicked point on the canvas btn – number of the mouse-button, defaults to 1 (left mouse button) add – True or False – if True, a new b...
python.library.turtle#turtle.onscreenclick
turtle.ontimer(fun, t=0) Parameters fun – a function with no arguments t – a number >= 0 Install a timer that calls fun after t milliseconds. >>> running = True >>> def f(): ... if running: ... fd(50) ... lt(60) ... screen.ontimer(f, 250) >>> f() ### makes the turtle march around...
python.library.turtle#turtle.ontimer
turtle.pendown() turtle.pd() turtle.down() Pull the pen down – drawing when moving.
python.library.turtle#turtle.pd
turtle.pen(pen=None, **pendict) Parameters pen – a dictionary with some or all of the below listed keys pendict – one or more keyword-arguments with the below listed keys as keywords Return or set the pen’s attributes in a “pen-dictionary” with the following key/value pairs: “shown”: True/False “pendown”: Tr...
python.library.turtle#turtle.pen
turtle.pencolor(*args) Return or set the pencolor. Four input formats are allowed: pencolor() Return the current pencolor as color specification string or as a tuple (see example). May be used as input to another color/pencolor/fillcolor call. pencolor(colorstring) Set pencolor to colorstring, which is a Tk c...
python.library.turtle#turtle.pencolor
turtle.pendown() turtle.pd() turtle.down() Pull the pen down – drawing when moving.
python.library.turtle#turtle.pendown
turtle.pensize(width=None) turtle.width(width=None) Parameters width – a positive number Set the line thickness to width or return it. If resizemode is set to “auto” and turtleshape is a polygon, that polygon is drawn with the same line thickness. If no argument is given, the current pensize is returned. >>> tu...
python.library.turtle#turtle.pensize
turtle.penup() turtle.pu() turtle.up() Pull the pen up – no drawing when moving.
python.library.turtle#turtle.penup
turtle.position() turtle.pos() Return the turtle’s current location (x,y) (as a Vec2D vector). >>> turtle.pos() (440.00,-0.00)
python.library.turtle#turtle.pos
turtle.position() turtle.pos() Return the turtle’s current location (x,y) (as a Vec2D vector). >>> turtle.pos() (440.00,-0.00)
python.library.turtle#turtle.position
turtle.penup() turtle.pu() turtle.up() Pull the pen up – no drawing when moving.
python.library.turtle#turtle.pu
turtle.radians() Set the angle measurement units to radians. Equivalent to degrees(2*math.pi). >>> turtle.home() >>> turtle.left(90) >>> turtle.heading() 90.0 >>> turtle.radians() >>> turtle.heading() 1.5707963267948966
python.library.turtle#turtle.radians
class turtle.RawTurtle(canvas) class turtle.RawPen(canvas) Parameters canvas – a tkinter.Canvas, a ScrolledCanvas or a TurtleScreen Create a turtle. The turtle has all methods described above as “methods of Turtle/RawTurtle”.
python.library.turtle#turtle.RawPen
class turtle.RawTurtle(canvas) class turtle.RawPen(canvas) Parameters canvas – a tkinter.Canvas, a ScrolledCanvas or a TurtleScreen Create a turtle. The turtle has all methods described above as “methods of Turtle/RawTurtle”.
python.library.turtle#turtle.RawTurtle
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.register_shape
turtle.reset() turtle.resetscreen() Reset all Turtles on the Screen to their initial state. Note This TurtleScreen method is available as a global function only under the name resetscreen. The global function reset is another one derived from the Turtle method reset.
python.library.turtle#turtle.reset
turtle.reset() turtle.resetscreen() Reset all Turtles on the Screen to their initial state. Note This TurtleScreen method is available as a global function only under the name resetscreen. The global function reset is another one derived from the Turtle method reset.
python.library.turtle#turtle.resetscreen
turtle.resizemode(rmode=None) Parameters rmode – one of the strings “auto”, “user”, “noresize” Set resizemode to one of the values: “auto”, “user”, “noresize”. If rmode is not given, return current resizemode. Different resizemodes have the following effects: “auto”: adapts the appearance of the turtle correspon...
python.library.turtle#turtle.resizemode
turtle.right(angle) turtle.rt(angle) Parameters angle – a number (integer or float) Turn turtle right by angle units. (Units are by default degrees, but can be set via the degrees() and radians() functions.) Angle orientation depends on the turtle mode, see mode(). >>> turtle.heading() 22.0 >>> turtle.right(45)...
python.library.turtle#turtle.right
turtle.right(angle) turtle.rt(angle) Parameters angle – a number (integer or float) Turn turtle right by angle units. (Units are by default degrees, but can be set via the degrees() and radians() functions.) Angle orientation depends on the turtle mode, see mode(). >>> turtle.heading() 22.0 >>> turtle.right(45)...
python.library.turtle#turtle.rt
class turtle.Screen Subclass of TurtleScreen, with four methods added.
python.library.turtle#turtle.Screen
turtle.screensize(canvwidth=None, canvheight=None, bg=None) Parameters canvwidth – positive integer, new width of canvas in pixels canvheight – positive integer, new height of canvas in pixels bg – colorstring or color-tuple, new background color If no arguments are given, return current (canvaswidth, canvas...
python.library.turtle#turtle.screensize
class turtle.ScrolledCanvas(master) Parameters master – some Tkinter widget to contain the ScrolledCanvas, i.e. a Tkinter-canvas with scrollbars added Used by class Screen, which thus automatically provides a ScrolledCanvas as playground for the turtles.
python.library.turtle#turtle.ScrolledCanvas
turtle.setheading(to_angle) turtle.seth(to_angle) Parameters to_angle – a number (integer or float) Set the orientation of the turtle to to_angle. Here are some common directions in degrees: standard mode logo mode 0 - east 0 - north 90 - north 90 - east 180 - west 180 - south 270 - south 270 - west...
python.library.turtle#turtle.seth
turtle.setheading(to_angle) turtle.seth(to_angle) Parameters to_angle – a number (integer or float) Set the orientation of the turtle to to_angle. Here are some common directions in degrees: standard mode logo mode 0 - east 0 - north 90 - north 90 - east 180 - west 180 - south 270 - south 270 - west...
python.library.turtle#turtle.setheading
turtle.goto(x, y=None) turtle.setpos(x, y=None) turtle.setposition(x, y=None) Parameters x – a number or a pair/vector of numbers y – a number or None If y is None, x must be a pair of coordinates or a Vec2D (e.g. as returned by pos()). Move turtle to an absolute position. If the pen is down, draw line. ...
python.library.turtle#turtle.setpos
turtle.goto(x, y=None) turtle.setpos(x, y=None) turtle.setposition(x, y=None) Parameters x – a number or a pair/vector of numbers y – a number or None If y is None, x must be a pair of coordinates or a Vec2D (e.g. as returned by pos()). Move turtle to an absolute position. If the pen is down, draw line. ...
python.library.turtle#turtle.setposition
turtle.settiltangle(angle) Parameters angle – a number Rotate the turtleshape to point in the direction specified by angle, regardless of its current tilt-angle. Do not change the turtle’s heading (direction of movement). >>> turtle.reset() >>> turtle.shape("circle") >>> turtle.shapesize(5,2) >>> turtle.settiltan...
python.library.turtle#turtle.settiltangle
turtle.setundobuffer(size) Parameters size – an integer or None Set or disable undobuffer. If size is an integer, an empty undobuffer of given size is installed. size gives the maximum number of turtle actions that can be undone by the undo() method/function. If size is None, the undobuffer is disabled. >>> turtl...
python.library.turtle#turtle.setundobuffer
turtle.setup(width=_CFG["width"], height=_CFG["height"], startx=_CFG["leftright"], starty=_CFG["topbottom"]) Set the size and position of the main window. Default values of arguments are stored in the configuration dictionary and can be changed via a turtle.cfg file. Parameters width – if an integer, a size in pi...
python.library.turtle#turtle.setup
turtle.setworldcoordinates(llx, lly, urx, ury) Parameters llx – a number, x-coordinate of lower left corner of canvas lly – a number, y-coordinate of lower left corner of canvas urx – a number, x-coordinate of upper right corner of canvas ury – a number, y-coordinate of upper right corner of canvas Set up u...
python.library.turtle#turtle.setworldcoordinates
turtle.setx(x) Parameters x – a number (integer or float) Set the turtle’s first coordinate to x, leave second coordinate unchanged. >>> turtle.position() (0.00,240.00) >>> turtle.setx(10) >>> turtle.position() (10.00,240.00)
python.library.turtle#turtle.setx
turtle.sety(y) Parameters y – a number (integer or float) Set the turtle’s second coordinate to y, leave first coordinate unchanged. >>> turtle.position() (0.00,40.00) >>> turtle.sety(-10) >>> turtle.position() (0.00,-10.00)
python.library.turtle#turtle.sety
class turtle.Shape(type_, data) Parameters type_ – one of the strings “polygon”, “image”, “compound” Data structure modeling shapes. The pair (type_, data) must follow this specification: type_ data “polygon” a polygon-tuple, i.e. a tuple of pairs of coordinates “image” an image (in this form only used in...
python.library.turtle#turtle.Shape
turtle.shape(name=None) Parameters name – a string which is a valid shapename Set turtle shape to shape with given name or, if name is not given, return name of current shape. Shape with name must exist in the TurtleScreen’s shape dictionary. Initially there are the following polygon shapes: “arrow”, “turtle”, “c...
python.library.turtle#turtle.shape
addcomponent(poly, fill, outline=None) Parameters poly – a polygon, i.e. a tuple of pairs of numbers fill – a color the poly will be filled with outline – a color for the poly’s outline (if given) Example: >>> poly = ((0,0),(10,-5),(0,10),(-10,-5)) >>> s = Shape("compound") >>> s.addcomponent(poly, "red", "b...
python.library.turtle#turtle.Shape.addcomponent
turtle.shapesize(stretch_wid=None, stretch_len=None, outline=None) turtle.turtlesize(stretch_wid=None, stretch_len=None, outline=None) Parameters stretch_wid – positive number stretch_len – positive number outline – positive number Return or set the pen’s attributes x/y-stretchfactors and/or outline. Set r...
python.library.turtle#turtle.shapesize
turtle.shapetransform(t11=None, t12=None, t21=None, t22=None) Parameters t11 – a number (optional) t12 – a number (optional) t21 – a number (optional) t12 – a number (optional) Set or return the current transformation matrix of the turtle shape. If none of the matrix elements are given, return the transform...
python.library.turtle#turtle.shapetransform
turtle.shearfactor(shear=None) Parameters shear – number (optional) Set or return the current shearfactor. Shear the turtleshape according to the given shearfactor shear, which is the tangent of the shear angle. Do not change the turtle’s heading (direction of movement). If shear is not given: return the current ...
python.library.turtle#turtle.shearfactor
turtle.showturtle() turtle.st() Make the turtle visible. >>> turtle.showturtle()
python.library.turtle#turtle.showturtle
turtle.speed(speed=None) Parameters speed – an integer in the range 0..10 or a speedstring (see below) Set the turtle’s speed to an integer value in the range 0..10. If no argument is given, return current speed. If input is a number greater than 10 or smaller than 0.5, speed is set to 0. Speedstrings are mapped ...
python.library.turtle#turtle.speed
turtle.showturtle() turtle.st() Make the turtle visible. >>> turtle.showturtle()
python.library.turtle#turtle.st
turtle.stamp() Stamp a copy of the turtle shape onto the canvas at the current turtle position. Return a stamp_id for that stamp, which can be used to delete it by calling clearstamp(stamp_id). >>> turtle.color("blue") >>> turtle.stamp() 11 >>> turtle.fd(50)
python.library.turtle#turtle.stamp
turtle.textinput(title, prompt) Parameters title – string prompt – string Pop up a dialog window for input of a string. Parameter title is the title of the dialog window, prompt is a text mostly describing what information to input. Return the string input. If the dialog is canceled, return None. >>> screen.t...
python.library.turtle#turtle.textinput
turtle.tilt(angle) Parameters angle – a number Rotate the turtleshape by angle from its current tilt-angle, but do not change the turtle’s heading (direction of movement). >>> turtle.reset() >>> turtle.shape("circle") >>> turtle.shapesize(5,2) >>> turtle.tilt(30) >>> turtle.fd(50) >>> turtle.tilt(30) >>> turtle.f...
python.library.turtle#turtle.tilt
turtle.tiltangle(angle=None) Parameters angle – a number (optional) Set or return the current tilt-angle. If angle is given, rotate the turtleshape to point in the direction specified by angle, regardless of its current tilt-angle. Do not change the turtle’s heading (direction of movement). If angle is not given:...
python.library.turtle#turtle.tiltangle
turtle.title(titlestring) Parameters titlestring – a string that is shown in the titlebar of the turtle graphics window Set title of turtle window to titlestring. >>> screen.title("Welcome to the turtle zoo!")
python.library.turtle#turtle.title
turtle.towards(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 angle between the line from turtle position to position specified by (x,y), the vector or the other turtle. This depends on the turtle’s start orientation whi...
python.library.turtle#turtle.towards
turtle.tracer(n=None, delay=None) Parameters n – nonnegative integer delay – nonnegative integer Turn turtle animation on/off and set delay for update drawings. If n is given, only each n-th regular screen update is really performed. (Can be used to accelerate the drawing of complex graphics.) When called wit...
python.library.turtle#turtle.tracer
class turtle.Turtle Subclass of RawTurtle, has the same interface but draws on a default Screen object created automatically when needed for the first time.
python.library.turtle#turtle.Turtle
turtle.turtles() Return the list of turtles on the screen. >>> for turtle in screen.turtles(): ... turtle.color("red")
python.library.turtle#turtle.turtles
class turtle.TurtleScreen(cv) Parameters cv – a tkinter.Canvas Provides screen oriented methods like setbg() etc. that are described above.
python.library.turtle#turtle.TurtleScreen
turtle.shapesize(stretch_wid=None, stretch_len=None, outline=None) turtle.turtlesize(stretch_wid=None, stretch_len=None, outline=None) Parameters stretch_wid – positive number stretch_len – positive number outline – positive number Return or set the pen’s attributes x/y-stretchfactors and/or outline. Set r...
python.library.turtle#turtle.turtlesize
turtle.undo() Undo (repeatedly) the last turtle action(s). Number of available undo actions is determined by the size of the undobuffer. >>> for i in range(4): ... turtle.fd(50); turtle.lt(80) ... >>> for i in range(8): ... turtle.undo()
python.library.turtle#turtle.undo
turtle.undobufferentries() Return number of entries in the undobuffer. >>> while undobufferentries(): ... undo()
python.library.turtle#turtle.undobufferentries
turtle.penup() turtle.pu() turtle.up() Pull the pen up – no drawing when moving.
python.library.turtle#turtle.up
turtle.update() Perform a TurtleScreen update. To be used when tracer is turned off.
python.library.turtle#turtle.update
class turtle.Vec2D(x, y) A two-dimensional vector class, used as a helper class for implementing turtle graphics. May be useful for turtle graphics programs too. Derived from tuple, so a vector is a tuple! Provides (for a, b vectors, k number): a + b vector addition a - b vector subtraction a * b inner product k...
python.library.turtle#turtle.Vec2D
turtle.pensize(width=None) turtle.width(width=None) Parameters width – a positive number Set the line thickness to width or return it. If resizemode is set to “auto” and turtleshape is a polygon, that polygon is drawn with the same line thickness. If no argument is given, the current pensize is returned. >>> tu...
python.library.turtle#turtle.width
turtle.window_height() Return the height of the turtle window. >>> screen.window_height() 480
python.library.turtle#turtle.window_height
turtle.window_width() Return the width of the turtle window. >>> screen.window_width() 640
python.library.turtle#turtle.window_width
turtle.write(arg, move=False, align="left", font=("Arial", 8, "normal")) Parameters arg – object to be written to the TurtleScreen move – True/False align – one of the strings “left”, “center” or right” font – a triple (fontname, fontsize, fonttype) Write text - the string representation of arg - at the cur...
python.library.turtle#turtle.write
turtle.write_docstringdict(filename="turtle_docstringdict") Parameters filename – a string, used as filename Create and write docstring-dictionary to a Python script with the given filename. This function has to be called explicitly (it is not used by the turtle graphics classes). The docstring dictionary will be...
python.library.turtle#turtle.write_docstringdict
turtle.xcor() Return the turtle’s x coordinate. >>> turtle.home() >>> turtle.left(50) >>> turtle.forward(100) >>> turtle.pos() (64.28,76.60) >>> print(round(turtle.xcor(), 5)) 64.27876
python.library.turtle#turtle.xcor
turtle.ycor() Return the turtle’s y coordinate. >>> turtle.home() >>> turtle.left(60) >>> turtle.forward(100) >>> print(turtle.pos()) (50.00,86.60) >>> print(round(turtle.ycor(), 5)) 86.60254
python.library.turtle#turtle.ycor
class type(object) class type(name, bases, dict, **kwds) With one argument, return the type of an object. The return value is a type object and generally the same object as returned by object.__class__. The isinstance() built-in function is recommended for testing the type of an object, because it takes subclasses ...
python.library.functions#type
exception TypeError Raised when an operation or function is applied to an object of inappropriate type. The associated value is a string giving details about the type mismatch. This exception may be raised by user code to indicate that an attempted operation on an object is not supported, and is not meant to be. If a...
python.library.exceptions#TypeError
Built-in Types The following sections describe the standard types that are built into the interpreter. The principal built-in types are numerics, sequences, mappings, classes, instances and exceptions. Some collection classes are mutable. The methods that add, subtract, or rearrange their members in place, and don’t re...
python.library.stdtypes
types — Dynamic type creation and names for built-in types Source code: Lib/types.py This module defines utility functions to assist in dynamic creation of new types. It also defines names for some object types that are used by the standard Python interpreter, but not exposed as builtins like int or str are. Finally, i...
python.library.types
types.AsyncGeneratorType The type of asynchronous generator-iterator objects, created by asynchronous generator functions. New in version 3.6.
python.library.types#types.AsyncGeneratorType
types.BuiltinFunctionType types.BuiltinMethodType The type of built-in functions like len() or sys.exit(), and methods of built-in classes. (Here, the term “built-in” means “written in C”.)
python.library.types#types.BuiltinFunctionType
types.BuiltinFunctionType types.BuiltinMethodType The type of built-in functions like len() or sys.exit(), and methods of built-in classes. (Here, the term “built-in” means “written in C”.)
python.library.types#types.BuiltinMethodType
types.CellType The type for cell objects: such objects are used as containers for a function’s free variables. New in version 3.8.
python.library.types#types.CellType
types.ClassMethodDescriptorType The type of unbound class methods of some built-in data types such as dict.__dict__['fromkeys']. New in version 3.7.
python.library.types#types.ClassMethodDescriptorType
class types.CodeType(**kwargs) The type for code objects such as returned by compile(). Raises an auditing event code.__new__ with arguments code, filename, name, argcount, posonlyargcount, kwonlyargcount, nlocals, stacksize, flags. Note that the audited arguments may not match the names or positions required by the ...
python.library.types#types.CodeType
replace(**kwargs) Return a copy of the code object with new values for the specified fields. New in version 3.8.
python.library.types#types.CodeType.replace
types.coroutine(gen_func) This function transforms a generator function into a coroutine function which returns a generator-based coroutine. The generator-based coroutine is still a generator iterator, but is also considered to be a coroutine object and is awaitable. However, it may not necessarily implement the __aw...
python.library.types#types.coroutine
types.CoroutineType The type of coroutine objects, created by async def functions. New in version 3.5.
python.library.types#types.CoroutineType
types.DynamicClassAttribute(fget=None, fset=None, fdel=None, doc=None) Route attribute access on a class to __getattr__. This is a descriptor, used to define attributes that act differently when accessed through an instance and through a class. Instance access remains normal, but access to an attribute through a clas...
python.library.types#types.DynamicClassAttribute
types.FrameType The type of frame objects such as found in tb.tb_frame if tb is a traceback object. See the language reference for details of the available attributes and operations.
python.library.types#types.FrameType