Best Coding Practices – Plurals When Naming List Variables

When you are naming variables that contain a list object using the plural form of what it represents is more straightforward and easy to read. Here are some insights on naming list variables.

For example, when you have a list of users and you’d want to iterate through it. You’d write something like this.

for user in users:
print(user)

The for user in users is better than for user in user_list.

But sometimes you would come across unquantifiable nouns like news. In that case, you would have to use news_list.

But please do not, forever, for as long as the universe exists, use something like for news in News. This should be punished severely.

First published Jul 29, 2012.

We totally get why you have an ad blocker. If you enjoy reading Geekswipe, turning it off for us helps keep the site alive and the science coming.

276 articles

Aeronautical engineer, product builder, developer, science fiction author, and an explorer. I'm the creator and editor of Geekswipe. I love writing about physics, aerospace, astronomy, and technology.

More by Karthikeyan KC

Leave a comment

Only used to notify you of replies. Never published.

Related