Do pythons like sugar?

Afanasiy abelikov72 at hotmail.com
Thu Jan 9 10:22:01 EST 2003


On Thu, 9 Jan 2003 14:18:14 GMT, Andrew Koenig <ark at research.att.com>
wrote:

>Afanasiy> Does Python? eg. `with self do:`
>
>   def format( self, width=80 ):    
>     lines = self.lines = ['']
>     textwidth = self.textwidth
>     i = 0
>     for word in self.text.split():  
>       if textwidth(lines[i]) + textwidth(word) <= width:
>         if textwidth(lines[i]) > 0:
>           lines[i] += ' '
>         lines[i] += word
>       else:
>         i += 1
>         lines.append(word)

Thank you, I did know that, and wrote it as such before ever asking my
question here. I did not like the thought of having to do that for all
future methods I would be writing. But I now see I have to. Thanks.





More information about the Python-list mailing list