Jeremy, that's some seriously twisted code. Unfortunately, the presence of Nones in the result when the list isn't an even multiple of 3 means for even more Kidness. Because now I have to check whether the value is None or else I get an exception.

For example:

<?python
    i= iter(product_list)
    rows= map(None, i, i, i)
?>
<table>
    <tr py:for="row in rows">
        <td py:for="product in row">
            <div py:if="product" py:strip="True">
                <h3>${product.title}</h3>
                <p>${product.description}</p>
            </div>
        </td>
    </tr>
</table>

True, it works. But it's a bit unpleasant that I need to explicitly check whether the value is None.

On 29 Dec, 2005, at 10:40 pm, Jeremy Jones wrote:

chunked_list = map(None, *[iter(some_list)]*3)
if you want 3 columns.

--
Jeff Watkins
http://newburyportion.com/

Computers, they're just a fad.


Reply via email to