From 6a23c24da13f5907d4c407e919bff187a3a0ae1d Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 6 Aug 2012 13:06:38 +0200 Subject: [UP] py.js, old != operator and basic dict handling bzr revid: xmo@openerp.com-20120806110638-1m4rg205sb3vjvm5 --- addons/web/static/lib/py.js/README.rst | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'addons/web/static/lib/py.js/README.rst') diff --git a/addons/web/static/lib/py.js/README.rst b/addons/web/static/lib/py.js/README.rst index 046db7153d1..eea1cbbf963 100644 --- a/addons/web/static/lib/py.js/README.rst +++ b/addons/web/static/lib/py.js/README.rst @@ -60,7 +60,7 @@ Builtins Same as tuple (``list`` is currently an alias for ``tuple``) ``dict`` - Implements just about nothing + Implements trivial getting and setting, nothing beyond that. Note that most methods are probably missing from all of these. @@ -72,14 +72,14 @@ sub-protocols) of the `Python 2.7 data model `_: Rich comparisons - Roughly complete implementation but for two limits: ``__eq__`` and - ``__ne__`` can't return ``NotImplemented`` (well they can but it's - not going to work right), and the behavior is undefined if a - rich-comparison operation does not return a ``py.bool``. + Pretty much complete (including operator fallbacks), although the + behavior is currently undefined if an operation does not return + either a ``py.bool`` or ``NotImplemented``. - Also, a ``NotImplemented`` result does not try the reverse - operation, not sure if it's supposed to. It directly falls back to - comparing type names. + ``__hash__`` is supported (and used), but it should return **a + javascript string**. ``py.js``'s dict build on javascript objects, + reimplementing numeral hashing is worthless complexity at this + point. Boolean conversion Implementing ``__nonzero__`` should work. @@ -93,6 +93,12 @@ Descriptor protocol As with attributes, ``__delete__`` is not implemented. Callable objects + Work, although the handling of arguments isn't exactly nailed + down. For now, callables get two (javascript) arguments ``args`` + and ``kwargs``, holding (respectively) positional and keyword + arguments. + + Conflicts are *not* handled at this point. Collections Abstract Base Classes Container is the only implemented ABC protocol (ABCs themselves @@ -119,8 +125,8 @@ implementation: ``py.js`` types. When accessing instance methods, ``py.js`` automatically wraps - these in a variant of ``py.def`` automatically, to behave as - Python's (bound) methods. + these in a variant of ``py.def``, to behave as Python's (bound) + methods. Why === -- cgit v1.2.3 From 7bcbadb099a71b731812ace299b98317edc49ae4 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 8 Oct 2012 14:06:19 +0200 Subject: [FIX] update py.js to 0.6, port existin classes to it, attempt to implement timedelta bzr revid: xmo@openerp.com-20121008120619-lhmexjnujjrigjn9 --- addons/web/static/lib/py.js/README.rst | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'addons/web/static/lib/py.js/README.rst') diff --git a/addons/web/static/lib/py.js/README.rst b/addons/web/static/lib/py.js/README.rst index eea1cbbf963..7601318df6d 100644 --- a/addons/web/static/lib/py.js/README.rst +++ b/addons/web/static/lib/py.js/README.rst @@ -1,14 +1,7 @@ What ==== -``py.js`` is a parser and evaluator of Python expressions, written in -pure javascript. -``py.js`` is not intended to implement a full Python interpreter -(although it could be used for such an effort later on), its -specification document is the `Python 2.7 Expressions spec -`_ (along with the -lexical analysis part). Syntax ------ @@ -69,7 +62,7 @@ Data model protocols ``py.js`` currently implements the following protocols (or sub-protocols) of the `Python 2.7 data model -`_: +<>`_: Rich comparisons Pretty much complete (including operator fallbacks), although the -- cgit v1.2.3