[Tutor] Are Empty "Placeholder" Functions possible?

Gooch, John John.Gooch at echostar.com
Thu May 26 19:05:13 CEST 2005


Thanks Kent!

-----Original Message-----
From: Kent Johnson [mailto:kent37 at tds.net] 
Sent: Thursday, May 26, 2005 9:52 AM
To: Gooch, John
Cc: tutor at python.org
Subject: Re: [Tutor] Are Empty "Placeholder" Functions possible?


Gooch, John wrote:
> Is there a way to create an empty function definition with no lines of 
> code in it? In my coding style I will often do this ( in other 
> languages ) for RAD just to remind myself that I will need to 
> implement the function later.

A block cannot be empty but there is a placeholder statement 'pass' that
does nothing.
> 
> Example: For a file handling class, I may need functions such as 
> copy,delete,move,etc so I want to start off with:
> 
> class FileHandler:
> 	def __init__(self):
> 
> 	def copy(self):
> 
> 	def delete(self):

class FileHandler:
	def __init__(self):
		pass

	def copy(self):
		pass

	def delete(self):
		pass

Kent


More information about the Tutor mailing list