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 should support this. > convert structs like: if (a > b): to if a > b: Well... that's a matter of fact, not just style. Sometimes parentheses help the reading; if a,b are not just plain names but somewhat complex instructions, parentheses should stay. > fill in spaces, but not in functions between operators: > > a+=1 => a += 1 > p(t + 1) => p(t+1) Code should be written this way. > 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. > > 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. what? No, I think you're missing the difference between 'is' and '=='. You could say it the other way for None, True, False, e.g. if there's a 'a == None' it could be safely converted to 'a is None', but again: this should be done while writing the code. > break long lines (in a reasonable way) well... this could be useful sometimes, but again... 'reason' is usually something human beings should employ, and shouldn't be 'outsourced' to computer programs. > make from: > if len(string) > 0: => if string: > and > if if len(string) < 1 orr if string == "" => if not string That's impossibile! Python is dynamically typed! How could the 'beautifier' understand what the 'string' name is bound to? It could be whatever object! > detect mixed line ending > detect tabs mixed with space > trim trailing whitespaces. Those are editor tasks. Get a good Editor or IDE. You haven't told us what OS are you on. If you're on Windows, UltraEdit can do most of the things you'd like. And don't rely on a software to correct human behaviours ^_^. -- Alan Franzoni <[EMAIL PROTECTED]> - Togli .xyz dalla mia email per contattarmi. Remove .xyz from my address in order to contact me. - GPG Key Fingerprint (Key ID = FE068F3E): 5C77 9DC3 BD5B 3A28 E7BC 921A 0255 42AA FE06 8F3E -- http://mail.python.org/mailman/listinfo/python-list