def x(self):
del self._x
This code is exactly equivalent to the first example. Be sure to give the additional functions the same name as the
original property (x in this case.)
The returned property object also has the attributes fget, fset, and fdel corresponding to the constructor arguments.
Changed in version 3.5: The docstrings of property objects are now writeable.
range(stop)
range(start, stop[, step])
Rather than being a function, range is actually an immutable sequence type, as documented in Ranges and Sequence Types —
list, tuple, range.
repr(object)
Return a string containing a printable representation of an object. For many types, this function makes an attempt to
return a string that would yield an object with the same value when passed to eval(), otherwise the representation is a
string enclosed in angle brackets that contains the name of the type of the object together with additional information
often including the name and address of the object. A class can control what this function returns for its instances by
defining a __repr__() method.
reversed(seq)
Return a reverse iterator. seq must be an object which has a __reversed__() method or supports the sequence protocol (the
__len__() method and the __getitem__() method with integer arguments starting at 0).
round(number[, ndigits])
Return the floating point value number rounded to ndigits digits after the decimal point. If ndigits is omitted, it returns
the nearest integer to its input. Delegates to number.__round__(ndigits).
For the built-in types supporting round(), values are rounded to the closest multiple of 10 to the power minus ndigits; if
two multiples are equally close, rounding is done toward the even choice (so, for example, both round(0.5) and round(-0.5)
are 0, and round(1.5) is 2). The return value is an integer if called with one argument, otherwise of the same type as
number.
Note
The behavior of round() for floats can be surprising: for example, round(2.675, 2) gives 2.67 instead of the expected 2.68.
This is not a bug: it’s a result of the fact that most decimal fractions can’t be represented exactly as a float. See
Floating Point Arithmetic: Issues and Limitations for more information.
class set([iterable])
Return a new set object, optionally with elements taken from iterable. set is a built-in class. See set and Set Types —
set, frozenset for documentation about this class.
For other containers see the built-in frozenset, list, tuple, and dict classes, as well as the collections module.
setattr(object, name, value)
This is the counterpart of getattr(). The arguments are an object, a string and an arbitrary value. The string may name an
existing attribute or a new attribute. The function assigns the value to the attribute, provided the object allows it. For
example, setattr(x, 'foobar', 123) is equivalent to x.foobar = 123.
class slice(stop)
class slice(start, stop[, step])
Return a slice object representing the set of indices specified by range(start, stop, step). The start and step arguments
default to None. Slice objects have read-only data attributes start, stop and step which merely return the argument values
(or their default). They have no other explicit functionality; however they are used by Numerical Python and other third
party extensions. Slice objects are also generated when extended indexing syntax is used. For example: a[start:stop:step]
or a[start:stop, i]. See itertools.islice() for an alternate version that returns an iterator.
sorted(iterable[, key][, reverse])
Return a new sorted list from the items in iterable.
Has two optional arguments which must be specified as keyword arguments.
key specifies a function of one argument that is used to extract a comparison key from each list element: key=str.lower.
The default value is None (compare the elements directly).
reverse is a boolean value. If set to True, then the list elements are sorted as if each comparison were reversed.