19 Nov

Weekly Update 128: Documentation refresh

This is a copy of our weekly newsletter for developers which you can subscribe to here.

Hello contributors,

Following on from the announcement of our first combined list of issues last week, we've been trying to make things easier when you decide to pick up a task and get coding. In particular, that means improvements to DuckDuckHack documentation both with small edits and corrections, as well as new information such as this article explaining How to review a pull request. Several parts have been rewritten so if you haven't checked out the docs recently, now's a good time to take a look.

Also, you may not know that the docs themselves are open source. If you find areas that are confusing or could be improved, please feel free to raise an issue or suggest a change in the duckduckhack-docs GitHub repository.

And speaking of GitHub, here are a few high-priority issue suggestions from our IA repositories...

Weekend Warriors

5-minute Fixes

More open tasks here...

Quick Tip

Python has many helpful built-in features so let's take a look at one in particular. Whatever language you code in, you may have tried to display a list of strings by joining them together with commas, often added using a for loop. With each iteration you add a comma, but you have to remember to drop it for the final iteration. You guessed it — Python makes this easy.

Let's say you have a list such as:

birds = ['duck', 'goose', 'swan']

Instead of a for loop you simply use join, which needs to be preceded by the separator you wish to use. For example:

print ', '.join(birds)

That will print duck, goose, swan — simple, huh? Not only that but it's also faster to execute than a for loop.

This is also possible in some other languages but be careful because the syntax may be different. For example in JavaScript the separator and array are reversed:

var output = birds.join(', ');

And with that, have a great weekend everyone!

- The DuckDuckGo Staff

2 Tweet

This blog has been archived

Thank you for reading and contributing lively discussion to our blog! Read more posts about online privacy on our new blog at spreadprivacy.com.

I am a beginner with the Python language, these tricks are very useful. Thanks !

posted by michaelstrhauss • 2 years and 3 months ago Link

That's great to hear - thanks for commenting!

posted by tagawa Staff • 2 years and 3 months ago Link