[pypy-svn] rev 2641 - pypy/trunk/doc

lac at codespeak.net lac at codespeak.net
Sat Dec 20 14:04:55 CET 2003


Author: lac
Date: Sat Dec 20 14:04:54 2003
New Revision: 2641

Modified:
   pypy/trunk/doc/goals.txt
Log:
added what has changed since 2.2 so we can check that we do this.



Modified: pypy/trunk/doc/goals.txt
==============================================================================
--- pypy/trunk/doc/goals.txt	(original)
+++ pypy/trunk/doc/goals.txt	Sat Dec 20 14:04:54 2003
@@ -20,7 +20,7 @@
 
 - help with automated testing 
 
-	what more do we want to do?
+	XXX add what more do we want to do?
 
 - http-server to present runtime/introspection information aiding 
   debugging and understanding of PyPy internals
@@ -35,10 +35,209 @@
 
 - Facilitate porting of extension modules to PyPy.
 
+- What's new since 2.2?
+ see http://www.python.org/doc/2.3.3/whatsnew -- Thank you amk!
+
+**PEPS**
+
++ PEP 218: A Standard Set Datatype -- set module --
+
++ PEP 263 defining Python Source Code encodings
+
++ PEP 273 Importing Modules from Zip Archives -- zipimport module  --
+
++ PEP 277: Unicode file name support for Windows NT
+
++ PEP 278: Universal Newline Support
+
++ PEP 279: enumerate()
+
++ PEP 282: The logging Package
+
++ PEP 285: A Boolean Type
+
++ PEP 293: Codec Error Handling Callbacks
+
++ PEP 301: Package Index and Metadata for Distutils
+
++ PEP 302: New Import Hooks
+
++ PEP 307: Pickle Enhancements
+
+**Check and see we have implemented these**
+
+* Extended Slices
+
+* The yield statement is now always a keyword
+
+* new built-in function enumerate()
+
+* Two new constants, True and False
+
+* The int() type constructor will now return a long integer instead of
+  raising an OverflowError when a string or floating-point number is too
+  large to fit into an integer. This can lead to the paradoxical result
+  that isinstance(int(expression), int) is false.
+
+* Built-in types now support the extended slicing syntax
+
+* A new built-in function, sum(iterable, start=0), adds up the numeric 
+  items in the iterable object and returns their sum. sum() only accepts 
+  numbers, meaning that you can't use it to concatenate a bunch of strings. 
+
+does it handle mixed floats and ints?
+
+* list.insert(pos, value) used to insert value at the front of the list 
+  when pos was negative. The behaviour has now been changed to be consistent 
+  with slice indexing, so when pos is -1 the value will be inserted before 
+  the last element, and so forth.  
+
+so to insert at the front?
+
+* list.index(value), which searches for value within the list and 
+  returns its index, now takes optional start and stop arguments to limit 
+  the search to only part of the list.
+
+* Dictionaries have a new method, pop(key[, default]), that returns the 
+  value corresponding to key and removes that key/value pair from the 
+  dictionary. If the requested key isn't present in the dictionary, 
+  default is returned if it's specified and KeyError raised if it isn't.
+
+* There's also a new class method, dict.fromkeys(iterable, value), that 
+  creates a dictionary with keys taken from the supplied iterator iterable 
+  and all values set to value, defaulting to None.
+
+  Also, the dict() constructor now accepts keyword arguments to simplify 
+  creating small dictionaries:
+
+  >>> dict(red=1, blue=2, green=3, black=4)
+  {'blue': 2, 'black': 4, 'green': 3, 'red': 1}
+
+
+* The assert statement no longer checks the __debug__ flag, so you can no 
+  longer disable assertions by assigning to __debug__. Running Python with 
+  the -O switch will still generate code that doesn't execute any assertions.
+
+So what if you want to disable assertions just within one module?
+
+* Most type objects are now callable, so you can use them to create new 
+  objects such as functions, classes, and modules. (This means that the 
+  new module can be deprecated in a future Python version, because you 
+  can now use the type objects available in the types module.) For example, 
+  you can create a new module object with the following code:
+
+  >>> import types
+  >>> m = types.ModuleType('abc','docstring')
+  >>> m
+  <module 'abc' (built-in)>
+  >>> m.__doc__
+  'docstring'
+
+* A new warning, PendingDeprecationWarning was added to indicate features 
+  which are in the process of being deprecated. The warning will not be 
+  printed by default. To check for use of features that will be deprecated
+  in the future, supply -Walways::PendingDeprecationWarning:: on the 
+  command line or use warnings.filterwarnings().
+
+* The process of deprecating string-based exceptions, as in 
+  raise "Error occurred", has begun. Raising a string will now trigger 
+  PendingDeprecationWarning.
+
+* Using None as a variable name will now result in a SyntaxWarning warning. 
+  In a future version of Python, None may finally become a keyword.
+
+* The xreadlines() method of file objects, introduced in Python 2.1,
+  is no longer necessary because files now behave as their own
+  iterator. xreadlines() was originally introduced as a faster way to
+  loop over all the lines in a file, but now you can simply write 
+  for line in file_obj. File objects also have a new read-only encoding
+  attribute that gives the encoding used by the file; Unicode strings
+  written to the file will be automatically converted to bytes using
+  the given encoding.
+
+* The method resolution order used by new-style classes has changed,
+  though you'll only notice the difference if you have a really
+  complicated inheritance hierarchy. Classic classes are unaffected by
+  this change. Python 2.2 originally used a topological sort of a
+  class's ancestors, but 2.3 now uses the C3 algorithm as described in
+  the paper ``A Monotonic Superclass Linearization for Dylan''. To
+  understand the motivation for this change, read Michele Simionato's
+  article ``Python 2.3 Method Resolution Order'', or read the thread
+  on python-dev starting with the message at
+  http://mail.python.org/pipermail/python-dev/2002-October/029035.html. Samuele
+  Pedroni first pointed out the problem and also implemented the fix
+  by coding the C3 algorithm.
+
+* Python runs multithreaded programs by switching between threads
+  after executing N bytecodes. The default value for N has been
+  increased from 10 to 100 bytecodes, speeding up single-threaded
+  applications by reducing the switching overhead. Some multithreaded
+  applications may suffer slower response time, but that's easily
+  fixed by setting the limit back to a lower number using
+  sys.setcheckinterval(N). The limit can be retrieved with the new
+  sys.getcheckinterval() function.
+
+* One minor but far-reaching change is that the names of extension
+  types defined by the modules included with Python now contain the
+  module and a "." in front of the type name. For example, in Python
+  2.2, if you created a socket and printed its __class__, you'd get
+  this output:
+
+  >>> s = socket.socket()
+  >>> s.__class__
+  <type 'socket'>
+
+  In 2.3, you get this:
+
+  >>> s.__class__
+  <type '_socket.socket'>
+
+* One of the noted incompatibilities between old- and new-style
+  classes has been removed: you can now assign to the __name__ and
+  __bases__ attributes of new-style classes. There are some
+  restrictions on what can be assigned to __bases__ along the lines of
+  those relating to assigning to an instance's __class__ attribute.
+
+**String Changes**
+
+* The in operator now works differently for strings. Previously, when
+  evaluating X in Y where X and Y are strings, X could only be a
+  single character. That's now changed; X can be a string of any
+  length, and X in Y will return True if X is a substring of Y. If X
+  is the empty string, the result is always True.
+
+   >>> 'ab' in 'abcd'
+   True
+   >>> 'ad' in 'abcd'
+   False
+   >>> '' in 'abcd'
+   True
+
+* The strip(), lstrip(), and rstrip() string methods now have an
+  optional argument for specifying the characters to strip. The
+  default is still to remove all whitespace characters:
+
+* The startswith() and endswith() string methods now accept negative
+  numbers for the start and end parameters.
+
+* Another new string method is zfill(), originally a function in the
+  string module. zfill() pads a numeric string with zeros on the left
+  until it's the specified width. Note that the % operator is still
+  more flexible and powerful than zfill().
+
+* A new type object, basestring, has been added. Both 8-bit strings
+  and Unicode strings inherit from this type, so isinstance(obj, basestring) 
+  will return True for either kind of string.  It's a completely abstract 
+  type, so you can't create basestring instances.
+
+* Interned strings are no longer immortal and will now be
+  garbage-collected in the usual way when the only reference to them
+  is from the internal dictionary of interned strings. 
+
 **Replace PyPy Core**
 
 Building a complete Python interpreter written in Python,
-using a subset of Python that avoids dynamic features
+using a subset of Python that avoids dynamic featureslll
 which would impair the objectives of RPython.
 
 - Design and implement the PyPy bytecode interpreter and


More information about the Pypy-commit mailing list