Brython - Python in the browser
rosuav at gmail.com
Sat Dec 22 09:31:26 CET 2012
On Sat, Dec 22, 2012 at 6:57 PM, Pierre Quentel
<pierre.quentel at gmail.com> wrote:
> I was over-simplifying - or, to put is less diplomatically, I screwed up - when I answered that the addition returned a string. As Chris pointed out, it made the explanation very confusing. My apologies
> The objects handled by + and <= can be :
> - strings, integers, floats
> - instances of $TagClass instances (more precisely, of classes copied from $TagClass, one for each HTML tag) : they are wrappers around a DOM element. The DOM element itself is the attribute "elt" of the $TagClass instance
> - the document, represented by the keyword doc. Its attribute "elt" is the document (top of the DOM tree)
> - instances of $AbstractClass, a container with a list of DOM elements. This list is the attribute "children" of the $TagClass instance
Ah! Okay, that makes a LOT more sense.
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.
More information about the Python-list