A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-April/003596.html below:

[Python-Dev] Object customization

[Python-Dev] Object customization [Python-Dev] Object customizationMoshe Zadka Moshe Zadka <mzadka@geocities.com>
Sat, 15 Apr 2000 19:44:25 +0200 (IST)
On Sat, 15 Apr 2000, Tim Peters wrote:

[Barry]
> Works for me!  I think function attrs would be a lousy place to put
> statics anyway.

[Tim Peters]
> Yes, but the alternatives are also lousy:  a global, or abusing default
> args.
<snipped examples>

Personally I kind of like the alternative of a class:

class _Foo:
	def __init__(self):
		self.n = 0

	def f(self):
		self.n = self.n+1
		return 42

f = _Foo().f

getting-n-out-of-f-is-left-as-an-exercise-ly y'rs, Z.
--
Moshe Zadka <mzadka@geocities.com>. 
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com




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