list unpack trick?

aurora aurora00 at gmail.com
Sun Jan 23 12:00:59 EST 2005


On Sat, 22 Jan 2005 10:03:27 -0800, aurora <aurora00 at gmail.com> wrote:

> I am think more in the line of string.ljust(). So if we have a  
> list.ljust(length, filler), we can do something like
>
>    name, value = s.split('=',1).ljust(2,'')
>
> I can always break it down into multiple lines. The good thing about  
> list unpacking is its a really compact and obvious syntax.

Just to clarify the ljust() is a feature wish, probably should be named  
something like pad().

Also there is another thread a few hours before this asking about  
essentially the same thing.

"default value in a list"
http://groups-beta.google.com/group/comp.lang.python/browse_frm/thread/f3affefdb4272270



More information about the Python-list mailing list