Table of Contents

Module: misc ../bkchem/misc.py

module containing miscelanous functions used in BKchem that don't fit anywhere else. Does not contain any objects

Functions   
difference
extend_bbox
filter_unique
has_one_value_only
intersection
lazy_apply
lazy_apply_ignorant
len_and_ending
list_difference
normalize_coords
plural_or_singular
reverse_molecule_formula
set_attr_or_property
signum
smallest_common_bbox
split_number_and_unit
  difference 
difference ( a,  b )

returns difference of 2 lists ( a-b)

  extend_bbox 
extend_bbox ( bbox,  pixels=1 )

  filter_unique 
filter_unique ( items )

  has_one_value_only 
has_one_value_only ( iterable )

  intersection 
intersection ( a,  b )

returns intersection of 2 lists

  lazy_apply 
lazy_apply ( function,  arguments )

similar to apply but returns a callable (lambda) that performs the apply when called.

  lazy_apply_ignorant 
lazy_apply_ignorant ( function,  arguments )

similar to apply but returns a callable (lambda) that performs the apply when called. the returned lambda can be called with any arguments which are ignored

  len_and_ending 
len_and_ending ( iterable )

  list_difference 
list_difference ( list )

return a list of differences between list members, the list is by 1 shorter than the original

  normalize_coords 
normalize_coords ( coords )

  plural_or_singular 
plural_or_singular ( iterable )

useful for string construction such as you have %d apple%s % (len(apples), plural_or_singular( apples)

  reverse_molecule_formula 
reverse_molecule_formula ( formula )

  set_attr_or_property 
set_attr_or_property (
        obj,
        name,
        value,
        )

sets value of attribute or property of object name to value

  signum 
signum ( a )

  smallest_common_bbox 
smallest_common_bbox ( bboxes )

  split_number_and_unit 
split_number_and_unit ( txt )


Table of Contents

This document was automatically generated on Tue Dec 12 13:46:43 2006 by HappyDoc version 2.1