A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/087012.html below:

Classes as objects

Classes as objects Classes as objectsJust van Rossum just at letterror.com
Fri Apr 27 03:44:45 EDT 2001
"Daniel Klein" <DanielK at jBASE.com> wrote:
> Haven't posted for a while but I this time I am requesting some assistence.
>
> I'm putting on a presentation on the benefits of Python over Java and one of
> the points I would like to make is how everything is an object, even
> Classes. Can anyone out there in PythonVille provide a simple (practical)
> example of how classes can be used as objects?

Ken Seehof wrote:
> Here's a debugging hack that messes with classes:
[ ... ]

While I agree it's useful to mess with this stuff for debugging, but you
don't need to go that for for classes to be useful as objects: classes can
be seen as factory functions, and passed around as such, eg:

class Foo:
	helperFactory = HelperClass
	def __init__(self, arg):
		self.helper = self.helperFactory(arg)

class Boo(Foo):
	helperFactory = OtherHelperClass

Just

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4