IPython Documentation

Table Of Contents

Previous topic

utils.PyColorize

Next topic

utils.autoattr

This Page

utils.attic

Module: utils.attic

Inheritance diagram for IPython.utils.attic:

Older utilities that are not being used.

WARNING: IF YOU NEED TO USE ONE OF THESE FUNCTIONS, PLEASE FIRST MOVE IT TO ANOTHER APPROPRIATE MODULE IN IPython.utils.

Classes

EvalDict

class IPython.utils.attic.EvalDict

Emulate a dict which evaluates its contents in the caller’s frame.

Usage: >>> number = 19

>>> text = "python"
>>> print "%(text.capitalize())s %(number/9.0).1f rules!" % EvalDict()
Python 2.1 rules!

NotGiven

class IPython.utils.attic.NotGiven

Functions

IPython.utils.attic.all_belong(candidates, checklist)

Check whether a list of items ALL appear in a given list of options.

Returns a single 1 or 0 value.

IPython.utils.attic.belong(candidates, checklist)

Check whether a list of items appear in a given list of options.

Returns a list of 1 and 0, one for each candidate given.

IPython.utils.attic.import_fail_info(mod_name, fns=None)

Inform load failure for a module.

IPython.utils.attic.map_method(method, object_list, *argseq, **kw)

map_method(method,object_list,*args,**kw) -> list

Return a list of the results of applying the methods to the items of the argument sequence(s). If more than one sequence is given, the method is called with an argument list consisting of the corresponding item of each sequence. All sequences must be of the same length.

Keyword arguments are passed verbatim to all objects called.

This is Python code, so it’s not nearly as fast as the builtin map().

IPython.utils.attic.mutex_opts(dict, ex_op)

Check for presence of mutually exclusive keys in a dict.

Call: mutex_opts(dict,[[op1a,op1b],[op2a,op2b]...]

IPython.utils.attic.popkey(dct, key, default=<class IPython.utils.attic.NotGiven at 0x9fb9a78>)

Return dct[key] and delete dct[key].

If default is given, return it if dct[key] doesn’t exist, otherwise raise KeyError.

IPython.utils.attic.with_obj(object, **args)

Set multiple attributes for an object, similar to Pascal’s with.

Example: with_obj(jim,

born = 1960, haircolour = ‘Brown’, eyecolour = ‘Green’)

Credit: Greg Ewing, in http://mail.python.org/pipermail/python-list/2001-May/040703.html.

NOTE: up until IPython 0.7.2, this was called simply ‘with’, but ‘with’ has become a keyword for Python 2.5, so we had to rename it.

IPython.utils.attic.wrap_deprecated(func, suggest='<nothing>')