All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: xen-devel@lists.xen.org, ian.jackson@eu.citrix.com,
	stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH v2] tools/pygrub: Make pygrub understand default entry in string format
Date: Fri, 27 Jun 2014 08:34:46 -0400	[thread overview]
Message-ID: <53AD64E6.5010404@oracle.com> (raw)
In-Reply-To: <1403870281.25894.52.camel@kazak.uk.xensource.com>

On 06/27/2014 07:58 AM, Ian Campbell wrote:
> On Thu, 2014-06-26 at 15:34 -0400, Boris Ostrovsky wrote:
>>                   if self.commands[com] is not None:
>> -                    if arg.strip() == "${saved_entry}":
>> +                    arg_strip = arg.strip()
>> +                    if arg_strip() == "${saved_entry}" or arg_strip == "${next_entry}":
> Is arg_strip (being the result of arg.strip()) really a callable object
> here?

No, that's a typo.


>> diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
>> index a4a2423..f46e54f 100644
>> --- a/tools/pygrub/src/pygrub
>> +++ b/tools/pygrub/src/pygrub
>> +            # We don't fully support submenus. Look for the leaf value in
>> +            # "submenu0>submenu1>...>menuentry" and hope that it's unique.
>> +            title = self.cf.default
>> +            while (1):
> I'm not much of a Python-head, but "while True:" surely?

They are both valid constructs (although possibly without parentheses). 
In fact, pygrub uses both:

ostr@workbase> egrep "while 1|while True" tools/pygrub/src/pygrub
         while 1:
         while 1:
         while True:
ostr@workbase>

Moreover, apparently, using '1' is very slightly faster. Not that I knew 
about it when I wrote this code ;-).

-boris

      reply	other threads:[~2014-06-27 12:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26 19:34 [PATCH v2] tools/pygrub: Make pygrub understand default entry in string format Boris Ostrovsky
2014-06-27 11:58 ` Ian Campbell
2014-06-27 12:34   ` Boris Ostrovsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53AD64E6.5010404@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.