suggestions for improving code fragment please

Joel Goldstick joel.goldstick at gmail.com
Thu Feb 28 20:56:47 CET 2013


On Thu, Feb 28, 2013 at 2:47 PM, The Night Tripper <jkn+gg at nicorp.co.uk>wrote:

> Hi there
>     I'm being very dumb ... how can I simplify this fragment?
>
i = 0
while arglist:
    self.myparm[i] = arglist.pop(0)
    i += 1



>         if arglist:
>             arglist.pop(0)
>             if arglist:
>                 self.myparm1 = arglist.pop(0)
>                 if arglist:
>                     self.myparm2 = arglist.pop(0)
>                     if arglist:
>                         self.myparm3 = arglist.pop(0)
>                         if arglist:
>                             self.parm4 = arglist.pop(0)
>         # ...
>
>     Thanks
>     J^n
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Joel Goldstick
http://joelgoldstick.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130228/d604329c/attachment.html>


More information about the Python-list mailing list