Brython - Python in the browser

Chris Angelico rosuav at
Sat Dec 22 10:08:25 CET 2012

On Sat, Dec 22, 2012 at 7:54 PM, Pierre Quentel
<pierre.quentel at> wrote:
>> Still, it tends to be a lot harder to explain, document, and read
>> documentation for, something that uses operators weirdly, rather than
>> keyword-searchable method names.
> You don't explain how to use the Python syntax (for instance the operator %, which behaves very differently between integers and strings) by explaining what happens in the underlying C code in the different cases, do you ?

Agreed, and it's sometimes confusing. I don't see "string % tuple" as
a good syntax; I prefer to spell it sprintf("format",arg,arg,arg).
When it comes to operators on strings, what I'd prefer to see is
something that does more-or-less what the operator does with integers
- for instance:

"This is a string" / " " ==> ["This","is","a","string"]

Taking a string modulo a tuple doesn't make any sense in itself, so it
CAN be given an alternative meaning. But if you see that in a program
and aren't sufficiently familiar with %s formatting to recognize it,
how are you going to locate the documentation on the subject? Googling
for 'python % string' doesn't help; 'python string modulo' brings up
an article on that explains the matter, but nothing
official. By contrast, searching for 'c sprintf' brings up heaps of
useful links, because 'sprintf' is a searchable keyword.

On the flip side, operator-based notations end up a lot more compact.
I'd definitely not want to give up, for instance, list comprehension
syntax. Difficulty of searching for docs is a downside, but definitely
not a blocker.


More information about the Python-list mailing list