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/2001-August/017045.html below:

[Python-Dev] __dynamic__ attribute

[Python-Dev] __dynamic__ attribute [Python-Dev] __dynamic__ attributeJames_Althoff@i2.com James_Althoff@i2.com
Tue, 14 Aug 2001 15:23:22 -0700
Given that  __dynamic__ will be part of Python in 2.2 . . .

Is it worth considering the possibility of making it more granular (somehow
controlling separately the modification of attribute values versus the
addition or deletion of attributes, perhaps)?  Currently it controls the
changing of a class object in all ways (if set to 1 it makes the class
object immutable).  It seems to me there is a significant difference in
general usage between:

>>> class A(object):
...   __dynamic__ = 1
...   count = 0
...   def incr(myclass): myclass.count += 1
...   incr = classmethod(incr)
...
>>> A.count
0
>>> A.incr()
>>> A.count
1
>>>

which is a pretty common idiom in Java and C++ and other more dynamic
things like adding/deleting attributes (data and methods) on the fly.

Jim





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