[Python-Dev] PEP 203 Augmented Assignment

Moshe Zadka Moshe Zadka <moshez@math.huji.ac.il>
Fri, 28 Jul 2000 08:49:30 +0300 (IDT)


On Thu, 27 Jul 2000, Guido van Rossum wrote:

> Another solution: require a class variable to indicate the class's
> awareness: e.g. you must define __getslice_takes_three_args__ when
> __getslice__(lo, hi, step) is supported, otherwise the call goes to
> __getitem__(slice(lo, hi, step)).

I don't think it can work: what about inheritance? Think of these
two cases:

class A:

	__getslice_takes_3_args__

	def __getslice__(...):
		...

class B(A):

	def __getslice__(...):
		... # something completely different

and

class C(A):

	def __getslice__(self, *args):
		# do something
		apply(A.__getslice__, (self,)+args)

> This is a bit like the feature flag bits in the type struct.

Which are ugly as hell too.....and only work because builtin types
have a flat inheritance.

oh-well-python-3000-is-just-around-the-corner-ly y'rs, Z.
--
Moshe Zadka <moshez@math.huji.ac.il>
There is no IGLU cabal.
http://advogato.org/person/moshez