Do pythons like sugar?

Afanasiy abelikov72 at hotmail.com
Thu Jan 9 05:51:55 EST 2003


On Thu, 09 Jan 2003 11:05:07 +0100, Max M <maxm at mxm.dk> wrote:

>No. But a little imagination takes you a long part of the way:
>
>def format( self, width=80 ):
>     twidth = self.textwidth
>     lines = ['']
>     i = 0
>     for word in self.text.split():
>         if twidth(lines[i]) + twidth(word) <= width:
>             if twidth(lines[i]) > 0:
>                 lines[i] += ' '
>             lines[i] += word
>         else:
>             i += 1
>             lines.append(word)
>     self.lines = lines

I already knew I could make aliases/references or 'macros' (as the
documentation calls them) to members I wish to access more easily.

I am not arguing for some addition to the language, I just asked a
question and the answer is apparently no, except for the knowledge
Dalke is withholding of course. But I can find that one my own...
I just thought this would be a little better than some irc channel.




More information about the Python-list mailing list