Newbie Tip: Classes and variable passing vs instances from ENGSOL

Richard Jones richard at
Thu Aug 2 06:32:32 CEST 2001

On Thursday 02 August 2001 14:12, engsol at wrote:
>   def __init__(self_1, input):
>       print "from the \"__init__ thing\"  :   " + input

Just a brief tip: the above can exploit python's ability to use two quote 
characters to delimit strings:

  def __init__(self_1, input):
      print 'from the "__init__ thing"  :   ' + input

also, since there's plenty of whitespace involved, you might as well use this 
slightly faster form of the above print statement that doesn't involve a 
string concatenation:

  def __init__(self_1, input):
      print 'from the "__init__ thing"  :  ', input

[note that I trimmed a space from the end of the first string to compensate 
for the additional space incurred using the ','.


More information about the Python-list mailing list