[Twisted-Python] What's the purpose of __?
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Wed Feb 16 10:42:18 EST 2011
On 03:19 pm, bra at fsn.hu wrote:
> Hi,
>
>I know what it does, I just don't get why it was used in smtp.py. But
>you are right, I should have mentioned that in the subject (adding ...
>in smtp.py).
The original author's intent is long since lost at this point. However,
a safe guess is that these attributes are not intended to be exposed to
users of the code (such as your LMTP subclass).
If you think there are good reasons for the attributes to be public
instead, then file a ticket explaining why, attach a patch (don't forget
unit tests), and add the "review" keyword
(<http://twistedmatrix.com/trac/wiki/ContributingToTwistedLabs>).
Because Twisted aims for a very high degree of backwards compatibility
in its public interfaces, some care will need to go into this change.
The meaning of the attributes will need documentation and unit tests.
State transitions need to be considered carefully. Consequences of the
attributes being changed by user code need to be taken into account.
Perhaps the best place to start is to discuss what functionality becomes
possible to implement if the "__inbody" protocol state tracking
attribute becomes public. When does an application care about this
protocol-level transition? When would it ever be legitimate to change
its value outside of the base protocol implementation?
Jean-Paul
More information about the Twisted-Python
mailing list