Do pythons like sugar?

Cliff Wells LogiplexSoftware at earthlink.net
Thu Jan 9 12:54:38 EST 2003


On Thu, 2003-01-09 at 07:31, Afanasiy wrote:
> On Thu, 09 Jan 2003 06:52:47 GMT, Afanasiy <abelikov72 at hotmail.com>
> wrote:
> 
> >I've written this method for a text formatting class...
> >But it's ugly as sin. With all those self's I consider
> >it much less readable than it could be...
> >
> >A few languages provide syntax sugar for dealing with
> >this by allowing you to localize the class scope.
> >
> >Does Python? eg. `with self do:`
> >
> >  def format( self, width=80 ):    
> >    self.lines = ['']
> >    i = 0
> >    for word in self.text.split():  
> >      if self.textwidth(self.lines[i]) + self.textwidth(word) <= width:
> >        if self.textwidth(self.lines[i]) > 0:
> >          self.lines[i] += ' '
> >        self.lines[i] += word
> >      else:
> >        i += 1
> >        self.lines.append(word)
> 
> It should not be common practice to slander someone who asks this.
> I'm going to attempt to ignore this thread now. Have a nice life.

I somehow missed the slander.  Perhaps there are language/cultural
problems showing themselves, but all I've seen in this thread are people
trying to help you and you getting bent out of shape about it.  Saying
that you stole something you didn't is _slander_.  Suggesting that your
code might be improved isn't.  It's called "constructive criticism", or
"help" for short.

You might have better luck in comp.lang.lisp.


-- 
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308  (800) 735-0555 x308






More information about the Python-list mailing list