Trees | Indices | Help |
|
---|
|
General-purpose types and utilities.
Copyright 2007-2012 Research Foundation State University of New York This file is part of QUB Express.
QUB Express is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
QUB Express is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License, named LICENSE.txt, in the QUB Express program directory. If not, see <http://www.gnu.org/licenses/>.
|
|||
Anon An object whose fields are the constructor keyword arguments. |
|||
DeathRattle Prints to stdout when it is finally freed, presumably at the same time as its owner. |
|||
Event Usage: |
|||
JsonAnon | |||
OverridingDict "Overrides" the base dict so keys are looked up first here, then if not found, in base dict. |
|||
Product | |||
Reffer Holds references to keep objects alive. |
|||
WeakCall Like WeakEvent, except there's at most one listener, and it can return a value. |
|||
WeakEvent Usage: |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
COLOR = defaultdict(<function <lambda> at 0xbf1772c>, {0: (0,
|
|||
ShowDropped = False
|
|||
UNSET_VALUE = 86738.82583
|
|||
VERSION =
|
|||
__package__ =
|
|||
c =
|
|||
e = 2.71828182846
|
|||
i = 19
|
|||
offset = 7
|
|||
pi = 3.14159265359
|
|
Returns (r,g,b) color coordinates corresponding to the hue, saturation and value. All coordinates are between 0 and 1. |
Returns the (hue, saturation, value) color coordinates corresponding to the RGB color. All coordinates are between 0 and 1. |
Returns r,g,b corresponding to x in [-1..1]. The scale moves smoothly around the color wheel from pink (-) to red (+), with brightness proportional to abs(x). |
Returns a function f which, when called, discards its own args and returns callback(*args, **kw). Lambda can be useful to share one message handler among many sources, but there's a limitation: >>> for i in xrange(N): chk[i].OnToggle += self__ref(lambda chk: self.__onToggle(i)) Here, the lambda binds not the value of i, but the stack location whose contents are repeatedly changed by the for loop. So all the lambdas are effectively doing self.__onToggle(N-1). Instead: >>> for i in xrange(N): chk[i].OnToggle += self.__ref(bind(self.__onToggle, i)) This creates a unique stack frame for your unique i, so it does what you expect. |
like builtin reduce(), but recursing by splitting in half. Doesn't seem to make a difference. |
Returns wrapped func that caches return values for specific args. All args must be immutable (e.g. tuples not lists). Example: >>> def factorial(n): >>> if n > 1: >>> return n * fast_fac(n-1) >>> else: >>> return 1 >>> fast_fac = memoize(factorial) |
Returns wrapped func that caches return values for specific args. All args must be immutable (e.g. tuples not lists). Example: >>> def factorial(n): >>> if n > 1: >>> return n * fast_fac(n-1) >>> else: >>> return 1 >>> fast_fac = memoize(factorial) |
Prints and returns its argument(s). Handy for testing callbacks. |
|
COLOR
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Mar 15 15:30:08 2012 | http://epydoc.sourceforge.net |