Python built-ins Flashcards
What does abs() do?
returns absolute if a complex number, it returns the magnitude. If x defined __abs__() it returns the result here.
all(iterable)
returns if all elements in iterable are True
ascii(object)
returns a string representing an object
bin(x)
convert to binary with 0b prefixed
bytearray([source[, encoding[, errors]]])
create an array of bytes
bytearray([source[, encoding[, errors]]])
create an array of bytes
bytes([source,[encoding,[errors]]])
creates byte object
callable(object)
returns true if callable. Implements __callable__ or a class
char(i)
returns the unicode char value
@classmethod
decorator for a class method can be called on an instance
compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)¶
compiles to an ast
complex([real,[image]])
returns a complex number
delattr(object,name)
deletes an object attribute
class dict(**kwarg)
builds a dictionary
dir([object])
without arg returns a list of names in current scope, with arg returns list of valid attribute for an object