[Twisted-Python] Re: [Twisted-commits] r15200 - I'd like _setUp thanks

Jean-Paul Calderone exarkun at divmod.com
Fri Nov 25 00:50:41 EST 2005


On Fri, 25 Nov 2005 09:44:42 +1100, Jonathan Lange <jml at mumak.net> wrote:
>On 25/11/05, Itamar Shtull-Trauring <itamar at itamarst.org> wrote:
>> On Thu, 2005-11-24 at 00:09 -0700, Jonathan Lange wrote:
>>
>> > Modified: branches/jml/trial-deferred-logic/twisted/test/test_ssl.py
>> > ==============================================================================
>> > --- branches/jml/trial-deferred-logic/twisted/test/test_ssl.py        (original)
>> > +++ branches/jml/trial-deferred-logic/twisted/test/test_ssl.py        Thu Nov 24 00:09:19 2005
>> > @@ -173,7 +173,7 @@
>> >
>> >  class StolenTCPTestCase(test_tcp.ProperlyCloseFilesTestCase, test_tcp.WriteDataTestCase):
>> >      def setUp(self):
>> > -        self._setUp()
>> > +        self._setUpStuff()
>>
>> If it happened here it might happen elsewhere... maybe use __ methods?
>> Or some other name.
>>
>
>I'd like to use a single underscore because I expect these methods to
>be overridden (that can't be a real word).  So, I'd much prefer to
>rename.  Suggestions welcome.

If you expect them to be overridden, they should not be underscore prefixed.  Underscore prefix indicates privateness.

Also, "stuff" has no place in any function or variable name anyplace in Twisted.  Slopping naming encourages slopping thinking.  Pick a name that describes the purpose of the method.

Lastly, why do you expect them to be overridden?  Do you just expect test_tcp.ProperlyCloseFilesTestCase and test_ssl.StolenTCPTestCase to override them, or do you expect other classes to do so?  If the latter, why?  If the former, what does it matter (and this code should be factored better, so the question is moot)?

Jean-Paul




More information about the Twisted-Python mailing list