Mercurial > js4py
diff source/javascript-objects.rst @ 211:4e6cfa066d1a
Use double backticks for inline code everywhere
| author | Radomir Dopieralski <radomir.dopieralski@allegro.pl> |
|---|---|
| date | Fri, 18 May 2012 16:56:15 +0200 |
| parents | 454054afcc0a |
| children |
line wrap: on
line diff
--- a/source/javascript-objects.rst Thu May 17 12:50:41 2012 +0200 +++ b/source/javascript-objects.rst Fri May 18 16:56:15 2012 +0200 @@ -5,7 +5,7 @@ ------------------- In JavaScript all objects are part of an inheritance tree. The -**create** function adds a node to the inheritance tree. +``create`` function adds a node to the inheritance tree. .. code-block:: javascript @@ -45,7 +45,7 @@ class explanation ^^^^^^^^^^^^^^^^^ -In Python we can subclass anything whose type is **type** (or a +In Python we can subclass anything whose type is ``type`` (or a subclass of type). A subclass (and its instances) inherits properties from the super-class. @@ -75,7 +75,7 @@ js> a['1'] 6 -In Python we can defined our own item methods. (The programmer owns +In Python we can define our own item methods. (The programmer owns the dot.) .. doctest:: @@ -101,7 +101,7 @@ >>> a['1'] 6 -Because **type(a)** is **A**, which has the special item methods, we +Because ``type(a)`` is ``A``, which has the special item methods, we get the special item behaviour. .. doctest:: @@ -113,7 +113,7 @@ On metaclass ------------ -Using previous definition, we cannot subclass **a** to create **b**. +Using previous definition, we cannot subclass ``a`` to create ``b``. .. doctest:: @@ -123,7 +123,7 @@ TypeError: Error when calling the metaclass bases object.__new__() takes no parameters -This is because **a** is not a type. The solution involves Python +This is because ``a`` is not a type. The solution involves Python metaclasses (an advanced topic). .. doctest:: @@ -157,7 +157,7 @@ Here is a more direct (and equivalent) construction (create an -instance of **ObjectType**, whose instances are objects). +instance of ``ObjectType``, whose instances are objects). .. doctest:: @@ -190,14 +190,14 @@ metaclass explanation ^^^^^^^^^^^^^^^^^^^^^ -Because **type(root)** is a subclass of type we can subclass root. +Because ``type(root)`` is a subclass of type we can subclass root. .. doctest:: >>> issubclass(type(root), type) True -Because the **type(root)** is **ObjectType**, which has special item +Because the ``type(root)`` is ``ObjectType``, which has special item methods, we get the special item behaviour. .. doctest:: @@ -210,7 +210,7 @@ ------------------ We can't call JavaScript objects (unless they are a function). But -**create** creates ordinary JavaScript objects. +``create`` creates ordinary JavaScript objects. .. code-block:: javascript
