STUDENTS: When you run the simulator via "make test" or similar,
you will see a command line generated by the makefile that looks like this:
MSG cmd line: ['fcfs.py', '2', '4', '110000', '12345', '2'], usage USAGE: python THISFILE.py NUMCONTEXTS NUMFASTIO SIMTIME SEED|None LOGLEVEL
A log level of 2 logs all of the simulation state changes and your code's msg()
calls, but it does not flush output prematurely. Flushing output a lot makes
the simulation run *really slowly*, but it is necessary if your simulation
crashes and you discover msg() messages missing from the log file. A crash
may kill an output buffer from Pythin. Flushing output buffers avoids that
problem, at the cost of extremely slow execution, so don't flush unless you
need to debug a crash and find that your debugging msg()s are missing.
To increase the log level for flushing, change this line in the makefile:
SIMLOGLEVEL = 2
to this:
SIMLOGLEVEL = 3
Change it back when you are done debugging to get the speed back.
# Parameter SIMLOGLEVEL is one of
# 0 (minimal),
# 1 (some logging of required simulation progress),
# 2 (log simulation state info and msgs, but minimize flush() calls,
# 3 (log simulation state info and msgs, use flush() (slow on Linux),
Help on class _Processor_ in module state2codeV15.CSC343Sim:
| _Processor_ extends __scheduledObject__ by adding the following fields:
| contextCount is the count of total hardware contexts.
| contextsFree is the count of available hardware contexts.
| fastio [] provides slots for _IOunit_ object references.
| msgbuf [] is reserved, currently unused.
| pcb {} is the set of current running processes, stored as a map
| {pid : PCB} (i.e., a map from pid to a PID object reference)
| child [] is a list of still-running PIDs (process IDs) forked by
| this _Processor_ object.
| number of the _Processor_ object, starting at 0.
| state defaults to None; it is set by the generated state machine.
| _Processor_ defines these methods; * denotes an event-triggering method:
| *fork() : (processID, threadID): starts a new process and its initial
| thread and terminal, storing the pid in child[] and {pid : PCB}
| map, where PCB is a reference to a PCB object.
| *idle(ticks): delays the _Processor_ *ticks* ticks, useful for fork()ing
| processes at temporal intervals in the simulation.
| *trigger(ticks, event, *args) : (args ...) stalls the _Processor_
| for *ticks* ticks, and then delivers the named *event" to the
| _Processor_ object with the *args* tuple as arguments.
| time() : int returns the current, global simulation time in ticks.
| fork(self)
| *fork() : (processID, threadID): starts a new process and its initial
| thread and terminal, storing the pid in child[] and {pid : PCB}
| map, where PCB is a reference to a PCB object.
| idle(self, ticks)
| *idle(ticks): delays the _Processor_ *ticks* ticks, useful for fork()ing
| processes at temporal intervals in the simulation.
| log(self, file, loglevel, tag=None)
| msg(self, message)
| Log text message from user code to log file.
| time(self)
| time() : int returns the current, global simulation time in ticks.
| trigger(self, ticks, event, *args)
| *trigger(ticks, event, *args) : (args ...) stalls the _Processor_
| for *ticks* ticks, and then delivers the named *event" to the
| _Processor_ object with the *args* tuple as arguments.
| sample(self, lower, upper, distType, *parameters)
| Return an integer in the inclusive range [lower, upper] where
| lower and upper are integers, and distType and parameters covary
| as follows.
| distType = 'uniform' gives a uniform distribution in the range
| [lower, upper] with parameters ignored.
| distType = 'gaussian' gives a gaussian distribution in the range
| [lower, upper] with parameters (mu, sigma) where mu is
| an int or float withing the range [lower, upper] that is the
| distribution mean, and sigma is the standard deviation. Results
| outside the range are discarded until a valid value
| is found and returned.
| distType = 'exponential' gives a exponential distribution in the range
| [lower, upper] with parameter (mu,) where mu is
| an int or float withing the range [lower, upper] that is
| the mean; the closer it is to lower, the steeper the dropoff.
| Results outside the range are discarded until a valid value
| is found and returned.
| distType = 'revexponential' gives a reverse exponential distribution
| in the range [lower, upper] that grows towards upper, with
| parameter (mu,) where mu is an int or float withing the range
| [lower, upper] that is the mean; the closer it is to upper,
| the steeper the rise.
| Results outside the range are discarded until a valid value
| is found and returned.
| assign(self, variable, value)
| assign the value parameter into the variable parameter, i.e.,
| variable = value, where variable is the string name of
| the variable. Returns a copy of the value.
| waitForEvent(self, eventType, isexclusive=False)
| *waitForEvent(self, eventType, isexclusive) is the mechanism for waiting for an
| eventType delivered by another thread in the simulation, which is delivered
| by another thread calling waitingobj.signalEvent(eventType), with the
| waitingobj simobj as the object parameter. Parameter isexclusive, if True, means
| respond only to that eventType; when False, respond to the arrival of any event.
| Leave isexclusive at False (default) to get maximum debug
| INFO on missed events logegd to log file.
| noop()
| noop() does nothing and returns None, it is useful as a
| default else in a conditional expression when no else value
| is needed.
| signalEvent(waitingobj, eventType, *results)
| signalEvent(waitingobj, eventType, *results) signals the waitingobj waiting within
| waitForEvent with the eventType and optional results value(s). See waitForEvent.
Help on class _Thread_ in module state2codeV15.CSC343Sim:
| _Thread_ defines these methods; * denotes an event-triggering method:
| *fork() : (pid, threadid) starts the initial thread and terminal of a
| new child process, storing the pid in child[] and
| {pid : PCB} in processor.pcb, where PCB is a reference to a
| PCB object.
| *wait(pid) : status waits for process pid to terminate and returns
| its exit(status) TODO: NOT YET DONE
| **kill(pid) terminates a process, with an exit status of -1.
| See exit() for addional details. Each thread within pid receive a
| abort() event. An abort() event is like a quit() event, except that non-daemon
| threads must never ignore a abort() event. They may ignore a quit() event.
| **exit(status) terminates all threads in this process.
| Note that in addition to terminating the current thread and scheduling
| an exit event that returns status, exit sends an quit() event to every other
| thread in this process. Those threads can handle this asychromous quit()
| events, or not, in the conventional manner of have a transition based on the
| arrival of an quit() event. The originating thread receives an exit event,
| not an quit event. The exit method releases any wait()ing threads waiting
| on the current process. TODO: NOT YET DONE
| *spawn() : threadid starts another thread of the current process,
| updating this process' PCB.
| *join(threadid) waits for thread threadid within the caller's process to terminate,
| when the latter invokes exit(), or retire() or receives an quit() event,
| or otherwise terminates, e.g., due to an exception. TODO: NOT YET DONE
| *retire() terminates this thread.
| It unblocks any threads waiting to join this thread, and, if this is the
| final thread in a process, retire() works the same as exit() with respect to
| releasing wait()ing threads. TODO: NOT YET DONE
| *cpu(ticks) requests ticks on a _Processor_ context.
| *io(index) requests I/O on fastio[index] or on terminal for index==-1.
| *sleep(ticks): delays the _Thread_ *ticks* ticks.
| *trigger(ticks, event, *args) : (args ...) stalls the _Thread_
| for *ticks* ticks, and then delivers the named *event" to the
| _Thread_ object with the *args* tuple as arguments.
| getid() : (machineid, processid, threadid) returns the
| (_Processor_.number, processNumber, threadNumber) of this thread.
| cpu(self, ticks)
| *cpu(ticks) requests ticks on a _Processor_ context.
| fork(self)
| *fork() : (pid, threadid) starts the initial thread and terminal of a
| new child process, storing the pid in child[] and
| {pid : PCB} in processor.pcb, where PCB is a reference to
| a PCB object.
| getid(self)
| getid() : (machineid, processid, threadid) returns the
| (_Processor_.number, processNumber, threadNumber) of this thread.
| io(self, index)
| *io(index) requests I/O on fastio[index] or on terminal for index==-1.
| log(self, file, loglevel, tag=None)
| msg(self, message)
| Log text message from user code to log file.
| retire(self)
| *retire() terminates this thread.
| TODO: retire() partly done, does not work with join() or wait().
| sleep(self, ticks)
| *sleep(ticks): delays the _Thread_ *ticks* ticks.
| spawn(self)
| *spawn() : threadid starts another thread of the current process,
| updating this process' PCB.
| time(self)
| time() : int returns the current, global simulation time in ticks.
| trigger(self, ticks, event, *args)
| *trigger(ticks, event, (args...)) : (args ...) stalls the _Thread_
| for *ticks* ticks, and then delivers the named *event" to the
| _Thread_ object with the *args* tuple as arguments.
| yieldcpu(self)
| *yieldcpu delays the _Thread_ 0 ticks, giving another thread
| a chance to run in the simulation.
| sample(self, lower, upper, distType, *parameters)
| Return an integer in the inclusive range [lower, upper] where
| lower and upper are integers, and distType and parameters covary
| as follows.
| distType = 'uniform' gives a uniform distribution in the range
| [lower, upper] with parameters ignored.
| distType = 'gaussian' gives a gaussian distribution in the range
| [lower, upper] with parameters (mu, sigma) where mu is
| an int or float withing the range [lower, upper] that is the
| distribution mean, and sigma is the standard deviation. Results
| outside the range are discarded until a valid value
| is found and returned.
| distType = 'exponential' gives a exponential distribution in the range
| [lower, upper] with parameter (mu,) where mu is
| an int or float withing the range [lower, upper] that is
| the mean; the closer it is to lower, the steeper the dropoff.
| Results outside the range are discarded until a valid value
| is found and returned.
| distType = 'revexponential' gives a reverse exponential distribution
| in the range [lower, upper] that grows towards upper, with
| parameter (mu,) where mu is an int or float withing the range
| [lower, upper] that is the mean; the closer it is to upper,
| the steeper the rise.
| Results outside the range are discarded until a valid value
| is found and returned.
| assign(self, variable, value)
| assign the value parameter into the variable parameter, i.e.,
| variable = value, where variable is the string name of
| the variable. Returns a copy of the value.
| waitForEvent(self, eventType, isexclusive=False)
| *waitForEvent(self, eventType, isexclusive) is the mechanism for waiting for an
| eventType delivered by another thread in the simulation, which is delivered
| by another thread calling waitingobj.signalEvent(eventType), with the
| waitingobj simobj as the object parameter. Parameter isexclusive, if True, means
| respond only to that eventType; when False, respond to the arrival of any event.
| Leave isexclusive at False (default) to get maximum debug
| INFO on missed events logegd to log file.
| noop()
| noop() does nothing and returns None, it is useful as a
| default else in a conditional expression when no else value
| is needed.
| signalEvent(waitingobj, eventType, *results)
| signalEvent(waitingobj, eventType, *results) signals the waitingobj waiting within
| waitForEvent with the eventType and optional results value(s). See waitForEvent.
Help on class PCB in module state2codeV15.CSC343Sim:
| PCB is the process control block. It is a data container for fields
| used by the processor and thread active objects. Each new process
| create by fork() gets its own PCB object, which will maintain
| a virtual memory map and open I/O file handles for assignments 3 & 4.
| All threads running in a process go into the threads[] list.
| PCB presently defines the following fields:
| 1. pid is the unique process ID.
| 2. threads [] is a sequence of thread object references in their
| order of creation in this process, from thread[0] (the initial
| thread) through thread[N-1], where N == len(threads).
| threads remain in this sequence until some thread in the process
| runs exit(), which kills all remaining threads in the process and
| removes the PCB.
| 3. activeThreads is a counter that starts as 0 upon fork(); each spawn()
| must increment it. When a thread dies it must decrement it and release
| joiners. When activeThreads goes to 0 the triggering thread must
| release waiters.
| 4. exitStatus is the exit status of the PCB's process, initialized to 0.
Help on class _IOunit_ in module state2codeV15.CSC343Sim:
| _IOunit_ is a complete class that does not require a user-defined
| state machine to generate its run() method. It has a run() method
| to implement its service loop -- an _Iounit_ object is an active
| object with a service thread that services requests on its io() method.
| Other methods are intended for internal use only, to serve io()
| requests. The plan is to add means for students to write _IOunit_
| state machines later in the semester. For now a slow I/O request
| delays in a uniform distribution of 7000..8000 ticks, and a fast I/O
| request delays in a uniform distribution of 500..1000 ticks TIMES
| the number of preceding requests in the queue. The requestq is a
| heapq (priority queue); for assignment 1 all requests are priority 1.
| _IOunit_ extends __scheduledObject__ by adding the following fields:
| processor is the _Processor_ object for this simulation.
| number of the _IOunit_ object, starting at 0.
| isfast is True for fast I/O (e.g., disk) or False for slow
| (e.g., terminal) as set by the object constructor.
| state defaults to None; it is set by the generated state machine.
| requestq [] is a simple FIFO of waiting _Thread_ objects at
| present. It may become a priority queue later in the semester.
| __beingServed__ is a 3-tuple (threadobj, startTime, startDelay) of the
| thread blocked on an io() request that is actually being served,
| or None when there is none.
| _IOunit_ defines these methods; * denotes an event-triggering method:
| *io(threadobj) requests I/O for _Thread_ reference threadobj,
| managing field access within this _IOunit_ object and using the
| global scheduler time manage the delay. This io() method is
| normally invoked by _Thread_.io(), and the latter method
| should schedule I/O only via calling this method.
| *trigger(ticks, event, *args) : (args ...) stalls the _IOunit_
| for *ticks* ticks, and then delivers the named *event" to the
| _IOunit_ object with the *args* tuple as arguments.
| io(self, threadobj)
| *io(threadobj) requests I/O for _Thread_ reference threadobj,
| managing field access within this _IOunit_ object and using the
| global scheduler time manage the delay. This io() method is
| normally invoked by _Thread_.io(), and the latter method
| should schedule I/O only via calling this method.
Help on class Queue in module state2codeV15.CSC343Sim:
class Queue(__builtin__.object)
| Queue can be either a FIFO queue or a min-priority queue implemented
| using library package heapq. Its FIFO versus min-priority queue is
| set when it is constructed.
| age(self, unaryAgingFunction, preservesOrder=False)
| age iterates through all elements in a priority Queue
| and applies the single-parameter function
| unaryAgingFunction to every priority, giving each
| element a new priority. If the caller determines
| that unaryAgingFunction preserves the relative order
| of the min-queue (all priority relationships stay the
| same), then the caller can set preservesOrder to True
| to avoid the overhead of resorting the Queue. The
| caller may pass preservesOrder=True only when
| unaryAgingFunction preserves relative comparison order
| of the priorities. Otherwise, preservesOrder must be
| its default value of False. This method raises
| ValueError when applied to a FIFO Queue.
| clear(self)
| Clear (empty) this Queue, reinitializing it to an empty Queue.
| clone(self)
| Return a shallow copy of this Queue object, such that if references
| to objects reside in the source Queue, the same references to
| those objects reside in the returned copy.
| delete(self, handle)
| Delete a previously enqueued value from the queue, where handle
| is a value previously returned by enq. This method throws an
| exception if the handle is no longer in this queue.
| This method applies to a FIFO or priority queue.
| RETURN value is the old, enqueued object value.
| deq(self)
| deq() : obj dequeues and returns the obj at the front of the Queue.
| enq(self, obj, priority=None)
| enq(obj, priority) enqueues the object pointed to by
| obj into this Queue, where priority must be None (default) for a
| FIFO queue, and must be any non-None value that can
| be compared in sort order to other priority values.
| The priority is typically a number, but it can be a tuple
| for numbers, for example, in the order:
| (mostSignificantKey, ... , leastSignificantKey).
| This is a min-queue, so use the "-" minus sign if
| necessary when a lrage value is the higher priority.
| RETURN value is an opaque handle that a client can pass
| to reprioritize() to change this obj's priority or to
| delete() to delete this entry from the queue.
| gen(self, isDestructive)
| Return a generator that iterates over elements in the Queue
| in FIFO or priority order as set by the Queue constructor.
| Setting flag isDestructive=True modified the contents of
| this Queue, invoking deq() until 0 elements remain.
| Setting flag isDestructive=False invokes deq() on a clone()
| of this Queue object. Note that if the calling client code
| changes the contents of an isDestructive=True Queue after gen()
| returns a generator, the values returned by the generator
| are undefined and may be erroneous.
| len(self)
| Returns the number of elements in this queue, >= 0.
| peek(self)
| peek() : obj, returns the obj at the front of the queue without
| removing it from the queue.
| reprioritize(self, handle, priority)
| Change the priority of a previously enqueued value to the
| priority parameter's value, where handle is a value previously
| returned by enq. This method throws an exception if
| this is a FIFO queue, or if the handle is no longer in this queue,
| or if priority is invalid according to the documentation for enq().
| RETURN value is the new handle; the previous one is no
| longer valid after this call.
Help on module math:
NAME
math
DESCRIPTION
This module is always available. It provides access to the
mathematical functions defined by the C standard.
FUNCTIONS
acos(...)
acos(x)
Return the arc cosine (measured in radians) of x.
acosh(...)
acosh(x)
Return the hyperbolic arc cosine (measured in radians) of x.
asin(...)
asin(x)
Return the arc sine (measured in radians) of x.
asinh(...)
asinh(x)
Return the hyperbolic arc sine (measured in radians) of x.
atan(...)
atan(x)
Return the arc tangent (measured in radians) of x.
atan2(...)
atan2(y, x)
Return the arc tangent (measured in radians) of y/x.
Unlike atan(y/x), the signs of both x and y are considered.
atanh(...)
atanh(x)
Return the hyperbolic arc tangent (measured in radians) of x.
ceil(...)
ceil(x)
Return the ceiling of x as a float.
This is the smallest integral value >= x.
copysign(...)
copysign(x, y)
Return x with the sign of y.
cos(...)
cos(x)
Return the cosine of x (measured in radians).
cosh(...)
cosh(x)
Return the hyperbolic cosine of x.
degrees(...)
degrees(x)
Convert angle x from radians to degrees.
exp(...)
exp(x)
Return e raised to the power of x.
fabs(...)
fabs(x)
Return the absolute value of the float x.
factorial(...)
factorial(x) -> Integral
Find x!. Raise a ValueError if x is negative or non-integral.
floor(...)
floor(x)
Return the floor of x as a float.
This is the largest integral value <= x.
fmod(...)
fmod(x, y)
Return fmod(x, y), according to platform C. x % y may differ.
frexp(...)
frexp(x)
Return the mantissa and exponent of x, as pair (m, e).
m is a float and e is an int, such that x = m * 2.**e.
If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0.
fsum(...)
fsum(iterable)
Return an accurate floating point sum of values in the iterable.
Assumes IEEE-754 floating point arithmetic.
hypot(...)
hypot(x, y)
Return the Euclidean distance, sqrt(x*x + y*y).
isinf(...)
isinf(x) -> bool
Check if float x is infinite (positive or negative).
isnan(...)
isnan(x) -> bool
Check if float x is not a number (NaN).
ldexp(...)
ldexp(x, i)
Return x * (2**i).
log(...)
log(x[, base])
Return the logarithm of x to the given base.
If the base not specified, returns the natural logarithm (base e) of x.
log10(...)
log10(x)
Return the base 10 logarithm of x.
log1p(...)
log1p(x)
Return the natural logarithm of 1+x (base e).
The result is computed in a way which is accurate for x near zero.
modf(...)
modf(x)
Return the fractional and integer parts of x. Both results carry the sign
of x and are floats.
pow(...)
pow(x, y)
Return x**y (x to the power of y).
radians(...)
radians(x)
Convert angle x from degrees to radians.
sin(...)
sin(x)
Return the sine of x (measured in radians).
sinh(...)
sinh(x)
Return the hyperbolic sine of x.
sqrt(...)
sqrt(x)
Return the square root of x.
tan(...)
tan(x)
Return the tangent of x (measured in radians).
tanh(...)
tanh(x)
Return the hyperbolic tangent of x.
trunc(...)
trunc(x:Real) -> Integral
Truncates x to the nearest Integral toward 0. Uses the __trunc__ magic method.
DATA
e = 2.7182818284590451
pi = 3.1415926535897931
Help on module operator:
NAME
operator - Operator interface.
DESCRIPTION
This module exports a set of functions implemented in C corresponding
to the intrinsic operators of Python. For example, operator.add(x, y)
is equivalent to the expression x+y. The function names are those
used for special methods; variants without leading and trailing
'__' are also provided for convenience.
FUNCTIONS
__abs__(...)
abs(a) -- Same as abs(a).
__add__(...)
add(a, b) -- Same as a + b.
__and__(...)
and_(a, b) -- Same as a & b.
__concat__(...)
concat(a, b) -- Same as a + b, for a and b sequences.
__contains__(...)
contains(a, b) -- Same as b in a (note reversed operands).
__delitem__(...)
delitem(a, b) -- Same as del a[b].
__delslice__(...)
delslice(a, b, c) -- Same as del a[b:c].
__div__(...)
div(a, b) -- Same as a / b when __future__.division is not in effect.
__eq__(...)
eq(a, b) -- Same as a==b.
__floordiv__(...)
floordiv(a, b) -- Same as a // b.
__ge__(...)
ge(a, b) -- Same as a>=b.
__getitem__(...)
getitem(a, b) -- Same as a[b].
__getslice__(...)
getslice(a, b, c) -- Same as a[b:c].
__gt__(...)
gt(a, b) -- Same as a>b.
__iadd__(...)
a = iadd(a, b) -- Same as a += b.
__iand__(...)
a = iand(a, b) -- Same as a &= b.
__iconcat__(...)
a = iconcat(a, b) -- Same as a += b, for a and b sequences.
__idiv__(...)
a = idiv(a, b) -- Same as a /= b when __future__.division is not in effect.
__ifloordiv__(...)
a = ifloordiv(a, b) -- Same as a //= b.
__ilshift__(...)
a = ilshift(a, b) -- Same as a <<= b.
__imod__(...)
a = imod(a, b) -- Same as a %= b.
__imul__(...)
a = imul(a, b) -- Same as a *= b.
__index__(...)
index(a) -- Same as a.__index__()
__inv__(...)
inv(a) -- Same as ~a.
__invert__(...)
invert(a) -- Same as ~a.
__ior__(...)
a = ior(a, b) -- Same as a |= b.
__ipow__(...)
a = ipow(a, b) -- Same as a **= b.
__irepeat__(...)
a = irepeat(a, b) -- Same as a *= b, where a is a sequence, and b is an integer.
__irshift__(...)
a = irshift(a, b) -- Same as a >>= b.
__isub__(...)
a = isub(a, b) -- Same as a -= b.
__itruediv__(...)
a = itruediv(a, b) -- Same as a /= b when __future__.division is in effect.
__ixor__(...)
a = ixor(a, b) -- Same as a ^= b.
__le__(...)
le(a, b) -- Same as a<=b.
__lshift__(...)
lshift(a, b) -- Same as a << b.
__lt__(...)
lt(a, b) -- Same as a> b.
__setitem__(...)
setitem(a, b, c) -- Same as a[b] = c.
__setslice__(...)
setslice(a, b, c, d) -- Same as a[b:c] = d.
__sub__(...)
sub(a, b) -- Same as a - b.
__truediv__(...)
truediv(a, b) -- Same as a / b when __future__.division is in effect.
__xor__(...)
xor(a, b) -- Same as a ^ b.
abs(...)
abs(a) -- Same as abs(a).
add(...)
add(a, b) -- Same as a + b.
and_(...)
and_(a, b) -- Same as a & b.
concat(...)
concat(a, b) -- Same as a + b, for a and b sequences.
contains(...)
contains(a, b) -- Same as b in a (note reversed operands).
countOf(...)
countOf(a, b) -- Return the number of times b occurs in a.
delitem(...)
delitem(a, b) -- Same as del a[b].
delslice(...)
delslice(a, b, c) -- Same as del a[b:c].
div(...)
div(a, b) -- Same as a / b when __future__.division is not in effect.
eq(...)
eq(a, b) -- Same as a==b.
floordiv(...)
floordiv(a, b) -- Same as a // b.
ge(...)
ge(a, b) -- Same as a>=b.
getitem(...)
getitem(a, b) -- Same as a[b].
getslice(...)
getslice(a, b, c) -- Same as a[b:c].
gt(...)
gt(a, b) -- Same as a>b.
iadd(...)
a = iadd(a, b) -- Same as a += b.
iand(...)
a = iand(a, b) -- Same as a &= b.
iconcat(...)
a = iconcat(a, b) -- Same as a += b, for a and b sequences.
idiv(...)
a = idiv(a, b) -- Same as a /= b when __future__.division is not in effect.
ifloordiv(...)
a = ifloordiv(a, b) -- Same as a //= b.
ilshift(...)
a = ilshift(a, b) -- Same as a <<= b.
imod(...)
a = imod(a, b) -- Same as a %= b.
imul(...)
a = imul(a, b) -- Same as a *= b.
index(...)
index(a) -- Same as a.__index__()
indexOf(...)
indexOf(a, b) -- Return the first index of b in a.
inv(...)
inv(a) -- Same as ~a.
invert(...)
invert(a) -- Same as ~a.
ior(...)
a = ior(a, b) -- Same as a |= b.
ipow(...)
a = ipow(a, b) -- Same as a **= b.
irepeat(...)
a = irepeat(a, b) -- Same as a *= b, where a is a sequence, and b is an integer.
irshift(...)
a = irshift(a, b) -- Same as a >>= b.
isCallable(...)
isCallable(a) -- Same as callable(a).
isMappingType(...)
isMappingType(a) -- Return True if a has a mapping type, False otherwise.
isNumberType(...)
isNumberType(a) -- Return True if a has a numeric type, False otherwise.
isSequenceType(...)
isSequenceType(a) -- Return True if a has a sequence type, False otherwise.
is_(...)
is_(a, b) -- Same as a is b.
is_not(...)
is_not(a, b) -- Same as a is not b.
isub(...)
a = isub(a, b) -- Same as a -= b.
itruediv(...)
a = itruediv(a, b) -- Same as a /= b when __future__.division is in effect.
ixor(...)
a = ixor(a, b) -- Same as a ^= b.
le(...)
le(a, b) -- Same as a<=b.
lshift(...)
lshift(a, b) -- Same as a << b.
lt(...)
lt(a, b) -- Same as a> b.
sequenceIncludes(...)
sequenceIncludes(a, b) -- Same as b in a (note reversed operands; deprecated).
setitem(...)
setitem(a, b, c) -- Same as a[b] = c.
setslice(...)
setslice(a, b, c, d) -- Same as a[b:c] = d.
sub(...)
sub(a, b) -- Same as a - b.
truediv(...)
truediv(a, b) -- Same as a / b when __future__.division is in effect.
truth(...)
truth(a) -- Return True if a is true, False otherwise.
xor(...)
xor(a, b) -- Same as a ^ b.
Help on module functools:
NAME
functools - functools.py - Tools for working with functions and callable objects
class partial(__builtin__.object)
| partial(func, *args, **keywords) - new function with partial application
| of the given arguments and keywords.
FUNCTIONS
reduce(...)
reduce(function, sequence[, initial]) -> value
Apply a function of two arguments cumulatively to the items of a sequence,
from left to right, so as to reduce the sequence to a single value.
For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
((((1+2)+3)+4)+5). If initial is present, it is placed before the items
of the sequence in the calculation, and serves as a default when the
sequence is empty.