[Tutor] Program review

Jeff Johnson jeff at san-dc.com
Sat Jan 5 22:58:21 CET 2008

I would like to "butt" in here and mention that this is some of the most 
useful information I have seen!  I am a programmer of 25 years that is 
new to Python.  This type of back and forth dialog on actual production 
code is extremely useful to learning the language.  I have done this 
with Ed Leafe with Dabo and it has helped a lot.

Keep it up!


Jeff Johnson
jeff at san-dc.com
SanDC, Inc.
Fax 623-869-0675

Ricardo Aráoz wrote:
> Kent Johnson wrote:
>> Ricardo Aráoz wrote:
>>> Ok, here is a corrected new version, I hope.
>>> Kent, the fact that Mensaje.__init__ reads the message configuration is
>>> by design (it's a feature, not a bug ;c) ).
>> You misunderstood my suggestion. I would add a method to Mensaje that 
>> creates the email.MIMEMultipart.MIMEMultipart() currently done by 
>> Correo.__init__().
>> Almost every line of Correo.__init__() is reading data from attributes 
>> of mensaje. This is a code smell called Feature Envy and is a clear sign 
>> that the code is in the wrong place.
>> In Mensaje you could have
>>      def createMessage(self):
>>          messg = email.MIMEMultipart.MIMEMultipart()
>>          messg['From'] = self.De
>>          messg['To'] = self.Para
>>          messg['Subject'] = self.Encabezado
>>          messg['Reply-To'] = self.ResponderA
>>          messg.preamble = 'This is a multi-part message in MIME format'
>>          messg.attach(email.MIMEText.MIMEText(self.html, 'html'))
>> Then in Correo.__init__() you would have
>>          self.messg = mensaje.createMessage()
>> It doesn't change the functionality but it is a better design.
> I see, yes it is better, I'll correct it. Thanks
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list