Package harold :: Package prog :: Package namespace :: Module ambiguous_member :: Class AmbiguousMember
[show private | hide private]
[frames | no frames]

Type AmbiguousMember

object --+
         |
        AmbiguousMember


An implementation artifact to manage ambiguous members.

Instances of this class are not supposed to be constructed directly, but rather by the ambiguous function.
Method Summary
  __init__(self, name, cls, warn_only, automate)
  __delete__(self, obj)
  __get__(self, obj, typ)
  __set__(self, obj, value)
  __str__(self)
  namespace_dec(self, namespace)
A decorator for assigning a namespace to a function.
  set_namespace(self, namespace, context)
Assign a given namespace (i.e.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value

Method Details

namespace_dec(self, namespace)

A decorator for assigning a namespace to a function.

Both following codes are equivalent:
   # version with decorator
   @ambiguous_member.namespace_dec (A_Class)
   def f(x,y,z):
       pass

   # equivalent version without the decorator
   def f(x,y,z):
       pass
   ambiguous_member.set_namespace (A_Class, f)

See Also: set_namespace

set_namespace(self, namespace, context=1)

Assign a given namespace (i.e. class from which the ambiguous member should take its definition) for the given context.

The context can be a callable, a property (in which case all methods of the property will taken into account), a class (in which case all members of the class will be taken into account), a module or an integer value.

If an integer value n, the namespace is assigned to the n next lines of code. If not given, the context defaults to value 1 (i.e. the next line of code).

IMPORTANT: the context must not be in the <stdin> file, because line number are nor reliable there. Any attempt to set a namespace to such a context will issue a warning and have no other effect.
Parameters:
namespace - a class defining the member
context - a callable, property, class, module or int

See Also: namespace_dec


Generated by Epydoc 2.1 on Mon Dec 18 15:25:58 2006 http://epydoc.sf.net