What is reversed() and what are its arguments?
reversed(object, /)
reversed() is a function that returns a reverse iterator. The object must have a __reversed__() method or __len__() and __getitem__().
What is callable() and what are its arguments
Returns True if the object argument appears callable, False if not.
What is ord() and what are its arguments?
ord(character, /)
ord() is a function that returns the ordinal value of a character.
What is vars() and what are its arguments?
vars()
vars(object, /)
vars() is a function that returns the __dict__ attribute for a module, class, instance, or any other object with a __dict__ attribute.
What is compile() and what are its arguments?
compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)
compile() is a function that compiles the source into a code or AST object, which can be executed by exec() or eval().
source can be a normal string, a byte string, or an AST object.
What is all() and what are its arguments?
all(iterable, /)
Returns true if all elements of the iterable are True (or if the iterable is empty).
What is dir() and what are its arguments?
dir()
dir(object, /)
dir() is a function that, without arguments, returns the list of names in the local scope. With aguments, it attempts to return a list of valid attributes for that object.
What is chr() and what are its arguments?
chr(codepoint, /)
Returns the string representing a character with the specified Unicode code point.
Ex.
chr(97) returns 'a'.
What is delattr() and what are its arguments?
delattr(object, name, /)
delattr() is a function that allows you to delete an attribute by name.
delattr(x, 'foobar') is equivalent to del x.foobar.
What is __import__() and what are its arguments?
__import__(name, globals=None, locals=None, fromlist=(), level=0)
__import__() is the function invoked by the import statement.
Don't use this! It is simpler and causes fewer problems to use importlib.import_module().
What is anext() and what are its arguments?
awaitable anext(async_iterator, /)
awaitable anext(async_iterator, default, /)
anext() is an async function that retrieves the next item from an iterator.
What is id() and what are its arguments?
id(object, /)
id() is a function that returns the identity of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime.Two objects with non-overlapping lifetimes may have the same ID.
What is property() and what are its arguments?
class property(fget=None, fset=None, fdel=None, doc=None)
property() is a function that returns a property attribute. Typically invoked as a decorator.
class Parrot:
def __init__(self):
self._voltage = 100000
@property
def voltage(self):
"""Get the current voltage."""
return self._voltage
What is hash() and what are its arguments?
hash(object, /)
hash() is a function that returns the hash value of an object (if it has one). Hash values are integers.
What is any() and what are its arguments?
any(iterable, /)
Returns True if any element of the iterable is true. Returns False if the iterable is empty.
E.g.
def any(iterable):
for element in iterable:
if element:
return True
return False
What is globals() and what are its arguments?
globals()
Returns the dictionary implementing the current module namespace.
What is sorted() and what are its arguments?
sorted(iterable, /, *, key=None, reverse=False)ΒΆ
sorted() is a function that returns a new sorted list from the items in iterable.
What is memoryview() and what are its arguments?
class memoryview(object)
Returns a "memory view" object created from the given argument.
A memory view is a zero-copy view into memory of bytes-like objects
What is aiter() and what are its arguments?
aiter(async_iterable, /)
Returns an asynchronous iterator for an asynchronous iterable.
What is locals() and what are its arguments?
locals()
locals() returns a mapping object representing the current local symbolic table, with variable names as the keys, and their currently bound references as the values.