| 
 
 
 
 bool, complex, float, intbytearray, bytes, strdict, frozenset, list, set, tuplememoryview, object, property, range, slice, type 
Draft for Information Only ContentPython Built-in Class Functions
 memoryview()Parameters
 Remarks
 
 object()Parameters
 Remarks
 
 property()Parameters
 Remarks
 
 range()Parameters
 Remarks
 
 slice()Parameters
 Remarks
 
 type()Parameters
 Remarks
 Source and Reference
 
Python Built-in Class Functions
The Python interpreter has some built-in class functions.
     memoryview()
 class memoryview(obj)Parametersmemoryview()to return a memory view object.objto specify the object to be returned fromRemarksobjmust support the buffer protocol. Built-in objects that support the buffer protocol includebytesandbytearrayA memoryviewhas the notion of an element, which is the atomic memory unit handled by the originating objectobj.
 object()
class objectParametersobjectto return a new featureless object.Remarksobjectis a base for all classesIt has the methods that are common to all instances of Python classes.objectdoes not accept any arguments.objectdoes not have a__dict__, so no arbitrary attributes can be assigned to an instance of theobjectclass.
 property()
class property(fget=None, fset=None, fdel=None, doc=None)Parametersproperty()to return a property attribute.fget=Noneto specify a function for getting an attribute value.fset=Noneto specify a function for setting an attribute value.fdel=Noneto specify a function for deleting an attribute value.doc=Noneto create a docstring for the attribute.RemarksIf docis given,docwill be the docstring of the property attribute. Otherwise the property will copyfget's docstring, if it exists. This makes it possible to create read-only properties easily usingproperty()as a decorator.A propertyobject hasgetter,setter, anddeletermethods usable as decorators that create a copy of the property with the corresponding accessor function set to the decorated function.The returned property object also has the attributes fget,fset, andfdelcorresponding to the constructor arguments.
 range()
 class range(stop)class range(start, stop[, step])
Parametersrange()to return an immutable sequencerangetype.stopto specify the stop of therange.startto specify the start of therange.[step]optional, to specify the step of therange.RemarksThe arguments start,stop, andstepmust be integers, either built-inintor any object that implements the__index__special method.if the stepargument is omitted, it defaults to 1.if the startargument is omitted, it defaults to 0if the stepargument is zero,ValueErroris raisedFor a positive step, the contents of a range𝑟are determined by the formula𝑟[𝑖]=start+step*𝑖where𝑖>=0and𝑟[𝑖]<stop.For a negative step, the contents of the range are still determined by the formula𝑟[𝑖]=start+step*𝑖, but the constraints are𝑖>=0and𝑟[𝑖]>stop.A range object will be empty if 𝑟[0]does not meet the value constraint.Ranges do support negative indices, but these are interpreted as indexing from the end of the sequence determined by the positive indices.Ranges containing absolute values larger than sys.maxsizeare permitted but some features, such aslen(), may raiseOverflowError.
 slice()
class slice(stop)class slice(start, stop[, step])
Parametersslice()to return a slice object.stopto specify the stop of slicestartto specify the start of slicestepoptional, to specify the step of sliceRemarksThe startandsteparguments default toNone.Slice objects have read-only data attributes start,stop, andstepwhich merely return the argument values (or their default).Slice objects have no other explicit functionality.
 type()
class type(object)class type(name, bases, dict)
Parameterstype()to return the type of an object.objectto specify the object to be returned fromnameto specify the class namebasesto specify the bases tuples itemizes the base classesdictto specify the dict dictionaryRemarksWith one argument, return the type of an object.The return value is a typeobject and generally the same object as returned byobject.__class__.With three arguments, return a new type object. This is essentially a dynamic form of the classstatement.The namestring is the class name and becomes the__name__attributeThe basetuple becomes the__bases__attributeThe dictdictionary is the namespace containing definitions for class body and s copied to a standard dictionary to become the__dict__attribute.
 Source and Reference©sideway
 
 ID: 200602102 Last Updated: 6/21/2020 Revision: 0 |  |