reflection.py

A support package for self-reporting

class reflection.Namespace(name='anonymous', **kwargs)[source]

Provide a cheap trivially repeatable namespace. I don’t know why a module or program would need two, but you can name it.

This probably lurks formally in python modules somewhere...

reflection.constant_dict(constant)[source]

allow simple specification of a defaultdict that uses a constant generator to default to the given constant.

constant the constant to be repeatedly generated

reflection.constant_iterator(constant)[source]

utility function to allow simple specification of a constant generator

constant the constant to be repeatedly generated

reflection.my_callername()[source]

Return the name of the caller of the method that invoked this method, so that it can know its caller’s name.

reflection.my_methodname()[source]

Return the name of the method that invoked this method, so that it can know its own name.

reflection.save_trace(e, printit='ignore', tmpdir='/var/tmp', dumpfile=None)[source]

I believe it would be useful to have this generally, but it is as yet not completely spec’d except for a special case in syqada that differs from this one.

currently raises not implemented

reflection.typecheck(parameter, *_types)[source]

Test parameter for the type given by _type, and raise a warning if no match