[pypy-svn] r4954 - pypy/branch/src-newobjectmodel/pypy/objspace/std
mwh at codespeak.net
mwh at codespeak.net
Sat Jun 5 14:29:28 CEST 2004
Author: mwh
Date: Sat Jun 5 14:29:27 2004
New Revision: 4954
Modified:
pypy/branch/src-newobjectmodel/pypy/objspace/std/typeobject.py
Log:
kill mounds of commented out code
Modified: pypy/branch/src-newobjectmodel/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/branch/src-newobjectmodel/pypy/objspace/std/typeobject.py (original)
+++ pypy/branch/src-newobjectmodel/pypy/objspace/std/typeobject.py Sat Jun 5 14:29:27 2004
@@ -85,141 +85,6 @@
w_obj.w__dict__ = space.newdict([])
return w_obj
-## def lookup_exactly_here(w_self, w_key):
-## space = w_self.space
-## multimethods = getmultimethods(space.__class__, w_self.__class__)
-## key = space.unwrap(w_key)
-## if not isinstance(key, str):
-## raise OperationError(space.w_TypeError,
-## space.wrap('attribute name must be string'))
-## try:
-## code = multimethods[key]
-## except KeyError:
-## raise KeyError # pass on the KeyError
-## if code.slice().is_empty():
-## raise KeyError
-## fn = function.Function(space, code, defs_w=code.getdefaults(space))
-## return space.wrap(fn)
-
-
-##def hack_out_multimethods(cls):
-## result = []
-## for base in cls.__bases__:
-## result += hack_out_multimethods(base)
-## for value in cls.__dict__.itervalues():
-## if isinstance(value, MultiMethod):
-## result.append(value)
-## return result
-
-##AllSlicedMultimethods = {}
-
-##def getmultimethods(spaceclass, typeclass):
-## try:
-## multimethods = AllSlicedMultimethods[spaceclass, typeclass]
-## except KeyError:
-## multimethods = AllSlicedMultimethods[spaceclass, typeclass] = {}
-## # import all multimethods of the type class and of the objspace
-## for multimethod in (hack_out_multimethods(typeclass) +
-## hack_out_multimethods(spaceclass)):
-## for i in range(len(multimethod.specialnames)):
-## # each MultimethodCode embeds a multimethod
-## name = multimethod.specialnames[i]
-## if name in multimethods:
-## # conflict between e.g. __lt__ and
-## # __lt__-as-reversed-version-of-__gt__
-## code = multimethods[name]
-## if code.bound_position < i:
-## continue
-## mmframeclass = multimethod.extras.get('mmframeclass')
-## if mmframeclass is None:
-## if len(multimethod.specialnames) > 1:
-## mmframeclass = SpecialMmFrame
-## else:
-## mmframeclass = MmFrame
-## code = MultimethodCode(multimethod, mmframeclass, typeclass, i)
-## multimethods[name] = code
-## # add some more multimethods with a special interface
-## code = MultimethodCode(spaceclass.next, NextMmFrame, typeclass)
-## multimethods['next'] = code
-## code = MultimethodCode(spaceclass.is_true, NonZeroMmFrame, typeclass)
-## multimethods['__nonzero__'] = code
-## return multimethods
-
-##class MultimethodCode(eval.Code):
-## """A code object that invokes a multimethod."""
-
-## def __init__(self, multimethod, framecls, typeclass, bound_position=0):
-## eval.Code.__init__(self, multimethod.operatorsymbol)
-## self.basemultimethod = multimethod
-## self.typeclass = typeclass
-## self.bound_position = bound_position
-## self.framecls = framecls
-## argnames = ['x%d'%(i+1) for i in range(multimethod.arity)]
-## argnames.insert(0, argnames.pop(self.bound_position))
-## varargname = kwargname = None
-## if multimethod.extras.get('varargs', False):
-## varargname = 'args'
-## if multimethod.extras.get('keywords', False):
-## kwargname = 'keywords'
-## self.sig = argnames, varargname, kwargname
-
-## def signature(self):
-## return self.sig
-
-## def getdefaults(self, space):
-## return [space.wrap(x)
-## for x in self.basemultimethod.extras.get('defaults', ())]
-
-## def slice(self):
-## return self.basemultimethod.slice(self.typeclass, self.bound_position)
-
-## def create_frame(self, space, w_globals, closure=None):
-## return self.framecls(space, self)
-
-##class MmFrame(eval.Frame):
-## def run(self):
-## "Call the multimethod, raising a TypeError if not implemented."
-## mm = self.code.slice().get(self.space)
-## args = self.fastlocals_w
-## w_result = mm(*args)
-## # we accept a real None from operations with no return value
-## if w_result is None:
-## w_result = self.space.w_None
-## return w_result
-
-##class SpecialMmFrame(eval.Frame):
-## def run(self):
-## "Call the multimethods, possibly returning a NotImplemented."
-## mm = self.code.slice().get(self.space)
-## args = self.fastlocals_w
-## try:
-## return mm.perform_call(args)
-## except FailedToImplement, e:
-## if e.args:
-## raise OperationError(*e.args)
-## else:
-## return self.space.w_NotImplemented
-
-##class NextMmFrame(eval.Frame):
-## def run(self):
-## "Call the next() multimethod."
-## mm = self.code.slice().get(self.space)
-## args = self.fastlocals_w
-## try:
-## return mm(*args)
-## except NoValue:
-## raise OperationError(self.space.w_StopIteration,
-## self.space.w_None)
-
-##class NonZeroMmFrame(eval.Frame):
-## def run(self):
-## "Call the is_true() multimethods."
-## mm = self.code.slice().get(self.space)
-## args = self.fastlocals_w
-## result = mm(*args)
-## return self.space.newbool(result)
-
-
def call__Type(space, w_type, w_args, w_kwds):
args_w = space.unpacktuple(w_args)
# special case for type(x)
More information about the Pypy-commit
mailing list