* [PATCH] remove tabs from xm/main.py
@ 2005-05-18 9:33 aq
0 siblings, 0 replies; 3+ messages in thread
From: aq @ 2005-05-18 9:33 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 623 bytes --]
hello,
while investigating xm/main.py, i found that it is mixed with tabs and
whitespaces. that is annoying and may get us misleaded when reading
code. looks like that the conventional coding style of Python (and
also C?) in Xen is to use (4) whitespaces instead of tabs? could
anybody confirm this?
i searched in all tree and found bunch of files like this. if nobody
complains, i will catch them all (both C and Python codes) and send in
1 patch to the list. any idea?
this patch replace tab with 4 whitespaces in (only) xm/main.py
Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
--
regards,
aq
[-- Attachment #2: tab.patch --]
[-- Type: text/plain, Size: 1095 bytes --]
===== tools/python/xen/xm/main.py 1.52 vs edited =====
--- 1.52/tools/python/xen/xm/main.py 2005-05-13 00:04:56 +09:00
+++ edited/tools/python/xen/xm/main.py 2005-05-18 17:35:54 +09:00
@@ -142,10 +142,10 @@ class Xm:
"""
self.name = args[0]
if len(args) < 2:
- args.append('help')
- help = self.helparg(args)
+ args.append('help')
+ help = self.helparg(args)
p = self.getprog(args[1], self.unknown)
- if help or len(args) < 2:
+ if help or len(args) < 2:
p.help(args[1:])
else:
p.main(args[1:])
@@ -646,10 +646,11 @@ class ProgSedf(Prog):
print "\nSet simple EDF parameters."
def main(self, args):
- if len(args) != 7: self.err("%s: Invalid argument(s)" % args[0])
- dom = args[1]
- v = map(int, args[2:7])
- server.xend_domain_cpu_sedf_set(dom, *v)
+ if len(args) != 7:
+ self.err("%s: Invalid argument(s)" % args[0])
+ dom = args[1]
+ v = map(int, args[2:7])
+ server.xend_domain_cpu_sedf_set(dom, *v)
xm.prog(ProgSedf)
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] remove tabs from xm/main.py
@ 2005-05-18 10:07 Ian Pratt
2005-05-18 15:44 ` aq
0 siblings, 1 reply; 3+ messages in thread
From: Ian Pratt @ 2005-05-18 10:07 UTC (permalink / raw)
To: aq, xen-devel
> while investigating xm/main.py, i found that it is mixed with
> tabs and whitespaces. that is annoying and may get us
> misleaded when reading code. looks like that the conventional
> coding style of Python (and also C?) in Xen is to use (4)
> whitespaces instead of tabs? could anybody confirm this?
>
> i searched in all tree and found bunch of files like this. if
> nobody complains, i will catch them all (both C and Python
> codes) and send in
> 1 patch to the list. any idea?
>
> this patch replace tab with 4 whitespaces in (only) xm/main.py
Particularly for python, this kind of patch can be *really* dangerous.
Please can you confirm that you fully understand the python indentation
rules (I don't), and that the patch was generated mechanically by a
script.
Thanks,
Ian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] remove tabs from xm/main.py
2005-05-18 10:07 [PATCH] remove tabs from xm/main.py Ian Pratt
@ 2005-05-18 15:44 ` aq
0 siblings, 0 replies; 3+ messages in thread
From: aq @ 2005-05-18 15:44 UTC (permalink / raw)
To: Ian Pratt; +Cc: xen-devel
On 5/18/05, Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk> wrote:
> > while investigating xm/main.py, i found that it is mixed with
> > tabs and whitespaces. that is annoying and may get us
> > misleaded when reading code. looks like that the conventional
> > coding style of Python (and also C?) in Xen is to use (4)
> > whitespaces instead of tabs? could anybody confirm this?
> >
> > i searched in all tree and found bunch of files like this. if
> > nobody complains, i will catch them all (both C and Python
> > codes) and send in
> > 1 patch to the list. any idea?
> >
> > this patch replace tab with 4 whitespaces in (only) xm/main.py
>
> Particularly for python, this kind of patch can be *really* dangerous.
> Please can you confirm that you fully understand the python indentation
> rules (I don't), and that the patch was generated mechanically by a
> script.
yes, indentation for C codes is not that important, but that is a
serious problem with Python. you are always adviced to *never* mix tab
and space when indenting Python code. that is *evil*. we must consider
this as bug, and fix them all.
looks like all the Python code use 4 spaces to identation. could any
developers who wrote those code confirm that they set tab as 4 spaces
in their editor?
i will try to fix all the tabs by replacing them with 4 spaces, check
it carefully to make sure no error is introduced, and send in the
patch (for Python code only).
regards,
aq
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-05-18 15:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-18 10:07 [PATCH] remove tabs from xm/main.py Ian Pratt
2005-05-18 15:44 ` aq
-- strict thread matches above, loose matches on Subject: below --
2005-05-18 9:33 aq
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.