[Python-ideas] Rosetta Code on Python.org site?

Terry Reedy tjreedy at udel.edu
Thu Oct 15 03:03:22 CEST 2015


On 10/7/2015 2:31 AM, Paddy3118 wrote:
 > Just saw what the Perl 6 site does  to punt the curious to their entries
 > on the Rosetta Code site here: http://perl6.org/community/rosettacode

Perl6 is apparently different from Perl 5 and before to justify adding 
Perl 6 sections after the Perl sections, with Perl entries re-written. 
Given the slow development and use of Perl 6, I can understand the Perl 
6 people wanting to promote Perl 6 that way. Python 3 is not quite in 
the same position.

 > and I thought maybe we could do something similar on Python.org
 > <http://Python.org>?

python-ideas is about future version of the language.
The pydotorg list discusses the site
https://mail.python.org/mailman/listinfo/pydotorg
This would be the place to suggest an addition under 'Community'.

But if modern Python 3 code is not welcome on the site (see below), I 
would not want it promoted as containing examples of 'Python' code.

 > I know that the core development team of Perl 6 have put a lot of effort
 > into their RC entries, and over the years I have seen evidence of tasks
 > being used to highlight areas for subsequent improvement in Perl 6.
 >
 > I don't /recognise /such a contribution from core development Pythoneers
 > on RC but members of the Python community have made great efforts in
 > making Python solutions available for most tasks on RC in a mixture of
 > Python 2 and 3

The page you reference seems a bit hostile to Python 3. It equates 
'Python' with 'Python 2' and calls code that also works with Python 3 
'unidiomatic Python', and makes no mention of the possibility of 
submitting Python 3.

 > and also showing greater use of our interactive command
 > line interface/REPL for solutions which other languages may have,

Since one cannot do anything in the REPL that one cannot do in a file, 
except leave out 'print', I do not see the point. Leaving '>>>' and 
'...' in examples only makes it hard to copy and paste.

 > but
 > rarely show unless the task asks specifically for an answer using a REPL.
 >
 > *In short:* Python on RC <http://rosettacode.org/wiki/Category:Python>

Reading this page, I am not sure how welcome I would be if I came and 
tried to contribute.

Aside from that, I do not see any obvious way to get of list of tasks 
without a Python solution, or is that an empty set?

 > has good code examples - why not advertise that fact on Python.org in a
 > similar way to the Perl 6 site?

Because I do not consider code with 'print x' instead of 'print(x)'. 
especially when that is the only thing keeping the code from also 
running on Python 3, to be a 'good code example'. Ditto for 2.x-only 
code (or 3.x-only code, for that matter) that is not labelled as such. 
On Python list and elsewhere, newbies frequently post 'I copied this 
code form ... and it does not run.' because they are running it on the 
wrong interpreter.

 > *Disclosure: *I should add that I am an administrator, task writer and
 > one of the Python code contributors to the Rosetta Code site.

Please consider making it more Python 3 friendly than it strikes me as 
being. Or if my impression is wrong, edit the Python page to at least 
treat Python 3 on an equal footing.

Out of curiosity, and to make a point: Does the current tasks include 
any that test the quality and completeness of unicode implementation? 
Something simple like the following, involving astral chars.

"Construct a string consisting of the unicode characters
U+33, U+333, U+11111, U+334, U+11112, U+11113. U+34. Print the decimal 
codepoint of the third character before the first occurrence of U+11113. 
(Answer: 69905.) The code should work on any platform the code could run 
on."

3.x code:
s = "\u0033\u0333\U00011111\u0334\U00011112\U00011113"
print(ord(s[s.index('\U00011113')-3]))

2.x code: several lines more to accommodate Windows and narrow unicode 
builds on some linuxes.


-- 
Terry Jan Reedy



More information about the Python-ideas mailing list