Mainly Tech projects on Python and Electronic Design Automation.

Friday, October 10, 2014

Python on the RosettaCode.org site

Do you know about the Rosetta code site?

Its purpose is to allow the comparison of different programming languages by having tasks that are completed in idiomatic code from many programming languages - the idea being that because the code examples are completing the same task, you can more easily compare the languages examples.

The Python language is well represented on the site with a large percentage of the tasks completed.

The type of the examples are written in what could be grouped into two styles:

  1. Python code suitable for cutting and pasting into a .py file and executing from the file.
  2. Sessions copied from the REPL of usually an idle session as it to is an idiomatic way to use Python, and and is ideal for some of the tasks with short Python solutions.
The description of the task is assumed understood and rarely appears in code comments and docstrings. Code is rarely "optimised" as speed and memory constraints are rarely mentioned in tasks (Rosetta Code is not geared to run examples, verify timings and memory use, ...).

I start off the writing of several tasks for Rosetta Code and always accompany those with an initial Python solution, I hope that this means more users of other languages will read the Python solution as it starts as the "canonical" solution for those wanting to see how other languages approach the task

If you want to contribute, you could lurk on the site for a while. Learn how other people edit. Maybe try some of the tasks for yourself, and see how things lie before making your first edit.

Some tips:


  • One language with multiple examples is discouraged unless you are using a different algorithm or a different language style. (You might see recursive/non recursive, or OO/functional style versions occasionally, depending also on the task).
  • Improving what is there is encouraged - replacing something because you wrote a version is not encouraged.
  • We would like RC to be made available in schools and colleges so don't use language that might fail a dumb site checker. (A bit difficult with the BrainF*ck language but we try and use obfuscations like brainf*ck where we can).  

In short:

Come join us. It's fun!

Followers

Subscribe Now: google

Add to Google Reader or Homepage

Go deh too!

whos.amung.us

Blog Archive