Re: Python Source Code Beautifier

2007-03-08 Thread Gabriel Genellina
En Thu, 08 Mar 2007 13:13:23 -0300, Alan Franzoni <[EMAIL PROTECTED]> escribió: > this > container does create a copy of the object even employing incremental > operators. > > Now, let's suppose I find that container type not useful for my purposes, > *or* I have already written a different cont

Re: Python Source Code Beautifier

2007-03-08 Thread Alan Franzoni
Il Wed, 07 Mar 2007 14:13:28 -0300, Gabriel Genellina ha scritto: > __iadd__, in general, is not *required* to modify the instance in place > (but should try to do that, if possible). After this code: > b = a > a += c > you can't assert than a and b both refer to the *same* object, a

Re: Python Source Code Beautifier

2007-03-07 Thread Gabriel Genellina
En Wed, 07 Mar 2007 10:29:29 -0300, Alan Franzoni <[EMAIL PROTECTED]> escribió: > Il Tue, 06 Mar 2007 01:55:54 -0300, Gabriel Genellina ha scritto: > If we rely on duck typing, by the way, we may encounter two types > quacking > like ducks, flying like ducks, but in fact acting as slightly di

Re: Python Source Code Beautifier

2007-03-07 Thread Alan Franzoni
Il Tue, 06 Mar 2007 01:55:54 -0300, Gabriel Genellina ha scritto: > The problem is that other people -not necesarily "smarter and more > experienced" than you- may use those features, and perhaps you have to > read, understand and modify some code written by someone else. > So, you should at

Re: Python Source Code Beautifier

2007-03-05 Thread Gabriel Genellina
En Mon, 05 Mar 2007 07:07:57 -0300, Alan Franzoni <[EMAIL PROTECTED]> escribió: > Il Sat, 03 Mar 2007 17:34:35 +1300, greg ha scritto: > >> This was all discussed at *very* great length many >> years ago, and the addition of in-place operators >> to the language was held up for a long time until

Re: Python Source Code Beautifier

2007-03-05 Thread Paul Boddie
On 2 Mar, 14:45, Alan Franzoni <[EMAIL PROTECTED]> wrote: > > I mean... I don't like that. I'm not really a Python expert, I found this > behaviour is documented in the language reference itself: > > http://docs.python.org/ref/augassign.html > > But... I don't know, still think it's confusing and n

Re: Python Source Code Beautifier

2007-03-05 Thread Alan Franzoni
Il Sat, 03 Mar 2007 17:34:35 +1300, greg ha scritto: > This was all discussed at *very* great length many > years ago, and the addition of in-place operators > to the language was held up for a long time until > the present compromise was devised. You might not > like it, but it's here to stay. S

Re: Python Source Code Beautifier

2007-03-02 Thread greg
Alan Franzoni wrote: > I would assume then, that if the '+=' operator > is assumed to modify objects in-place, it would just fail on immutable > objects, wouldn't I? Then you wouldn't be able to do things like x = 3 x += 1 which would result in howls of outrage from the *other* half of t

Re: Python Source Code Beautifier

2007-03-02 Thread Alan Franzoni
Il 28 Feb 2007 14:09:09 -0800, [EMAIL PROTECTED] ha scritto: > Seems obvious and desirable to me. Bare "=" is the way you assign a > name to an object; saying "NAME =" will rebind the name, breaking the > connection between a and b. Without it, they continue to refer to the > same object; exten

Re: Python Source Code Beautifier

2007-03-01 Thread Gabriel Genellina
En Wed, 28 Feb 2007 19:09:09 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > On Feb 28, 11:24 am, Alan Franzoni > <[EMAIL PROTECTED]> wrote: >> Il 27 Feb 2007 16:14:20 -0800, [EMAIL PROTECTED] ha scritto: >> >> > Those mean different things: >> >> a=[1] >> b=a >> a += [2]

Re: Python Source Code Beautifier

2007-02-28 Thread Franz Steinhaeusler
Hello, thanks. pythontidy (with maybe some patches could be useful) not directly related but: pyflakes looks quite interesting too. and I try out (again) pylint and pychecker or a combination of these could bring good results, I assume. ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Source Code Beautifier

2007-02-28 Thread [EMAIL PROTECTED]
On Feb 28, 11:24 am, Alan Franzoni <[EMAIL PROTECTED]> wrote: > Il 27 Feb 2007 16:14:20 -0800, [EMAIL PROTECTED] ha scritto: > > > > > Those mean different things: > > a=[1] > b=a > a += [2] > a > > [1, 2] > b > > [1, 2] > a=[1] > b=a > a = a + [2] > a >

RE: Python Source Code Beautifier

2007-02-28 Thread Delaney, Timothy (Tim)
Alan Franzoni wrote: > Yeah, that's right, it could have semantic differences, but that > shouldn't be the case anyway. I mean, if I don't define an __iadd__ > method, writing > > a += n > > or > > a = a + n > > is just the same, right? > > So, if I bother to define an __iadd__ method, I sho

Re: Python Source Code Beautifier

2007-02-28 Thread Duncan Booth
Alan Franzoni <[EMAIL PROTECTED]> wrote: > Yeah, that's right, it could have semantic differences, but that > shouldn't be the case anyway. I mean, if I don't define an __iadd__ > method, writing > > a += n > > or > > a = a + n > > is just the same, right? > > > So, if I bother to define an

Re: Python Source Code Beautifier

2007-02-28 Thread Alan Franzoni
Il 27 Feb 2007 16:14:20 -0800, [EMAIL PROTECTED] ha scritto: > Those mean different things: > a=[1] b=a a += [2] a > [1, 2] b > [1, 2] a=[1] b=a a = a + [2] a > [1, 2] b > [1] This is a really nasty one! I just answered to Tim above here, and the

Re: Python Source Code Beautifier

2007-02-28 Thread Alan Franzoni
Il Wed, 28 Feb 2007 07:53:47 +1100, Delaney, Timothy (Tim) ha scritto: > Alan Franzoni wrote: >> the += operator is syntactic sugar just to save time... if one >> doesn't use it I don't think it's a matter of beauty. > > This change can have semantic differences, and so should not be done for > a

Re: Python Source Code Beautifier

2007-02-27 Thread [EMAIL PROTECTED]
On Feb 27, 3:45 am, Franz Steinhaeusler <[EMAIL PROTECTED]> wrote: > Hello, I did not find any reasonable pyhton source code beautifier > program (preferable gui). > > Some would ask why? Program it immediatly good. > > (BTW: Would be a nice project, if I would have more spare time). > > Ich have s

RE: Python Source Code Beautifier

2007-02-27 Thread Delaney, Timothy (Tim)
Alan Franzoni wrote: >> self.scriptcount = self.scriptcount + 1 => self.scriptcount += 1 > > the += operator is syntactic sugar just to save time... if one > doesn't use it I don't think it's a matter of beauty. This change can have semantic differences, and so should not be done for anything ex

Re: Python Source Code Beautifier

2007-02-27 Thread Michael Spencer
Franz Steinhaeusler wrote: > Use Spaces, size: 4 > detect mixed line ending > detect tabs mixed with space > trim trailing whitespaces. look at: tools/scripts/reindent.py > convert structs like: if (a > b): to if a > b: > fill in spaces, but not in functions between operators: > > a+=1 =>

Re: Python Source Code Beautifier

2007-02-27 Thread Alan Franzoni
Il Tue, 27 Feb 2007 09:45:42 +0100, Franz Steinhaeusler ha scritto: > Hello, I did not find any reasonable pyhton source code beautifier > program (preferable gui). Well, most of the things you ask should be written as such, not written and then beautified! > Use Spaces, size: 4 Your editor sho

Re: Python Source Code Beautifier

2007-02-27 Thread Chuck Rhode
Franz Steinhaeusler wrote this on Tue, 27 Feb 2007 09:45:42 +0100. My reply is below. > Hello, I did not find any reasonable pyhton source code beautifier > program (preferable gui). -snip- > Is there such a tool around? Why, yes! Yes, there is: o http://lacusveris.com/PythonTidy/PythonTidy.

Re: Python Source Code Beautifier

2007-02-27 Thread Neil Hodgson
Franz Steinhaeusler: > Hello, I did not find any reasonable pyhton source code beautifier > program (preferable gui). > ... > convert: > ... > from "is" to "==" and "is not" to "!=" (ok a find replace could do that > easily also), but in a program that would be more comfortable. That's an unsa