---
title: "pydash: fill no longer grows the list in Python | VulCode"
description: "In pydash, a Python utility library, we fixed fill: when start is greater than end the list no longer grows or duplicates items, and negative indices work."
url: "https://vulcode.com/en/opensource/contributions/pydash"
lang: "en"
---

[All contributions](https://vulcode.com/en/opensource/contributions)

dgilland/pydash

# pydash

A Python utility library modelled on Lo-Dash from JavaScript. It offers ready-made operations on lists, dicts and strings in a functional style.

[See the repository](https://github.com/dgilland/pydash) [All contributions](https://vulcode.com/en/opensource/contributions)

- **Language**: Python
- **GitHub stars**: 1,449
- **Merged changes**: 1
- **Project site**: [pydash.readthedocs.io](http://pydash.readthedocs.io)

## What we changed

fill no longer grows the list or duplicates elements when start comes after end, and negative indices work as they do in Python slices.

### What this work shows

- Python list slicing and negative indices

- In-place list mutation

- Parametrised tests with pytest

What was broken

### fill grew the list instead of doing nothing

When start was greater than end, fill glued overlapping slices of the list together: fill([1, 2, 3, 4], "x", 4, 1) gave [1, 2, 3, 4, 3, 2, 3]. Elements were duplicated and no value was written at all.

How we fixed it

### An empty range leaves the list alone

start and end are clamped to the range from 0 to the list length, with negative indices handled as in slices, and values are written in place in a loop. When start is not less than end the list stays the same, as with lodash's _.fill.

[#257](https://github.com/dgilland/pydash/pull/257)

## Merged change 1

- [#257 Fix `fill` growing the array when `start` comes after `end` Merged 20 September 2026](https://github.com/dgilland/pydash/pull/257)

## What it taught us

We test functions against the order and sign of their arguments: here a reversed range glued overlapping slices together and grew the list. The fix keeps the in-place mutation and parity with lodash's _.fill.

[More about this technology: Python](https://vulcode.com/en/technologies/python)

## Other projects we write code for

- [**more-itertools** Python · 4,106 stars A Python library with more routines for operating on iterables, beyond the itertools module.](https://vulcode.com/en/opensource/contributions/more-itertools)

- [**funcy** Python · 3,507 stars A collection of practical functional tools for Python, including helpers for sequences, collections and iterators.](https://vulcode.com/en/opensource/contributions/funcy)

- [**python-benedict** Python · 1,606 stars A Python dict subclass with key path access and built-in reading and writing of many formats, such as JSON, YAML, TOML and CSV.](https://vulcode.com/en/opensource/contributions/python-benedict)

- [**pydantic-extra-types** Python · 345 stars Extra types for data validation in Pydantic, the popular Python library: MAC addresses, time zones, semantic versions, ULIDs and many more.](https://vulcode.com/en/opensource/contributions/pydantic-extra-types)

- [**pytimeparse** Python · 296 stars A small Python module that turns time expressions such as 1h30m or 1:24 into a number of seconds.](https://vulcode.com/en/opensource/contributions/pytimeparse)

- [**Node.js** JavaScript · 123,955 stars The JavaScript runtime built on V8 that runs servers, command line tools and front-end build pipelines. It ships a built-in node:sqlite module for working with SQLite databases.](https://vulcode.com/en/opensource/contributions/nodejs)

## Describe your project.

A free quote comes back within an hour during working hours.

### Rather skip the form?

Ask in the chat or write to us directly.

Open the chat

- **Email**: [hello@vulcode.com](mailto:hello@vulcode.com)
- **Phone**: [+48 576 043 920](tel:+48576043920)
- **Discord**: [discord.gg/vulcode](https://discord.gg/vulcode)
