pre-PEP for optional 'pass'

holger krekel pyth at devel.trillke.net
Wed Apr 17 12:24:07 EDT 2002


On Wed, Apr 17, 2002 at 10:21:15AM +0100, Andy Gimblett wrote:
> We're veering slightly from the original reason for this point, which
> was how to write stub functions/methods which will be implemented
> later.  The above certainly doesn't indicate any intent to actually
> implement the methods (in fact, on the contrary, it suggests they
> could be removed). 

Ok. this is the first reason i actually hear for leaving pass out.
(are there other ones?).

when i needed not-implemented classes i used this wrapper:

class NotImplemented:
   def __getattr__(self,name): return lambda *x,**y: None # or raise error

you can use it like this:

class HalfImplemented(NotImplemented):
	def implementedmethod1(self, ...): ...
	...

and the method calls that don't exist silently return None/1
or raise an error. that was a nice solution for me.

Really, i am still interested: what are (other) interesting
(convenience) reasons for making 'pass' optional?

	holger





More information about the Python-list mailing list