[pypy-svn] r12552 - pypy/dist/pypy/documentation
pedronis at codespeak.net
pedronis at codespeak.net
Thu May 19 18:11:55 CEST 2005
Date: Thu May 19 18:11:54 2005
New Revision: 12552
reworked a bit the sections Object restrictions and a new Flow restrictions to approximate better current reality
--- pypy/dist/pypy/documentation/coding-guide.txt (original)
+++ pypy/dist/pypy/documentation/coding-guide.txt Thu May 19 18:11:54 2005
@@ -90,23 +90,48 @@
.. _`wrapped object`: coding-guide.html#wrapping-rules
-We are using
- the same variable in the same context can receive values of different types,
- at a possible overhead cost. For example, a variable that can contain a
- `wrapped object`_ or None is efficiently implemented as a PyObject* pointer that
- can be NULL, but a variable that can contain either an integer or a float must
- be implemented as a union with a type tag in C.
+ variables should contain values of at most one type as described in `Object restrictions`_
+ at each control flow point, that means that joining control paths using the same variable
+ to contain both a float and a int should be avoided. Mixing None (basically with the role of
+ a null pointer) and `wrapped objects` and class instances is allowed.
all module globals are considered constants.
+ all allowed
+ does not create an array. It is only allowed in for loops. The step argument
+ must be a constant.
+ run-time definition of classes or functions is not allowed.
+ generators are not supported.
++ fully supported
++ see below `Exception rules`_ for restrictions on exceptions raised by built-in operations
+We are using
**integer, float, string, boolean**
avoid string methods and complex operations like slicing with a step
@@ -114,7 +139,8 @@
no variable-length tuples; use them to store or return pairs or n-tuples of
+ values. Each combination of types for elements and length constitute a separate
+ and not mixable type.
@@ -129,9 +155,6 @@
interned in CPython, i.e. short strings that look like identifiers). The
implementation could safely decide that all dict keys should be interned.
- all allowed
@@ -153,11 +176,6 @@
A few builtin functions will be used, while this set is not defined
completely, yet. Some builtin functions are special forms:
- does not create an array. It is only allowed in for loops. The step argument
- must be a constant.
+ may be used with basic types that have a length. But len is a special form
@@ -176,11 +194,6 @@
+ inheritance is supported
+ classes are first-class objects too
-+ fully supported
-+ see below for restrictions on exceptions raised by built-in operations
wrapped objects are borrowed from the object space. Just like in CPython, code
More information about the Pypy-commit