Notice: While JavaScript is not essential for this website, your interaction with the content will be limited. Please turn JavaScript on for the full experience.
...constructor is no longer called. This makes a much larger group of classes picklable by default, but may occasionally change semantics. To force calling __init__() on unpickling, define a __getinitargs__() method. Other changes too, in particular cPickle now handles classes defined in packages correctly. The same change applies to copying instances with copy.py. Locale support in the "re" (Perl regular expressions) module. Use the flag re.L (or re.LOCALE) to enable locale-specific...
...declaration creates a class attribute for each variable containing a descriptor, and setting a class attribute to a default value would overwrite this descriptor. There's no check that prevents you to override an instance variable already defined by a base class using a __slots__ declaration. If you do that, the instance variable defined by the base class is inaccessible (except by retrieving its descriptor directly from the base class; this could be used to rename it). Doing this r...
...constructor). The first argument to __new__ must be a class; the remaining arguments are the arguments as seen by the constructor call. A __new__ method that overrides a base class's __new__ method may call that base class's __new__ method. The first argument to the base class's __new__ method call should be the class argument to the overriding __new__ method, not the base class; if you were to pass in the base class, you would get an instance of the base class. Unless you want to...
...constructor). The first argument to __new__ must be a class; the remaining arguments are the arguments as seen by the constructor call. A __new__ method that overrides a base class's __new__ method may call that base class's __new__ method. The first argument to the base class's __new__ method call should be the class argument to the overriding __new__ method, not the base class; if you were to pass in the base class, you would get an instance of the base class. (This is really jus...
...constructor are now a shorthand for creating a dictionary from the key/value pairs, and dict.fromkeys(iterable) returns a dict whose keys are taken from the given iterable (the values default to None). Also a new dict method was added, pop(key), which removes and returns the value corresponding to the given key. filter() - now returns Unicode when the input is Unicode. Various bugs with subclasses of built-in types fixed. (New in 2.3a2.) int() - this can now return a long when converting a str...
...constructor, Message.add_payload(), Utils.dump_address_pair(), Utils.decode(), Utils.encode() New deprecations: Generator.__call__(), Message.get_type(), Message.get_main_type(), Message.get_subtype(), the 'strict' argument to the Parser constructor. These will be removed in email 3.1. Support for Python earlier than 2.3 has been removed (see PEP 291). All defect classes have been renamed to end in 'Defect'. Some FeedParser fixes; also a MultipartInvariantViolationDefect will be added to messag...
...constructor would ignore all arguments. This is changed now: the constructor refuses arguments in this case. This might break code that worked under Python 2.2. The simplest fix is to add a no-op __init__: def __init__(self, *args, **kw): pass. Through a bytecode optimizer bug (and I bet you didn't even know Python had a bytecode optimizer :-), "unsigned" hex/oct constants with a leading minus sign would come out with the wrong sign. ("Unsigned" hex/oct constants are those...
...constructor argument. Even though YAPPS supports definition of tokens in the grammar, we have not used this capability in XPath, since we have provided my own scanner class. The YAPPS parser will only require a token() method from the scanner object, which must return a four-tuple (start, end, token type, token value). In case of a syntax error, the generated parser will raise a yappsrt.SyntaxError exception. This exception will take the current position and an error message. En...
...declarations. It is illegal to assign to the name __debug__, which is set when the interpreter starts. It is effectively a compile-time constant. A warning will be issued if a global statement for a variable follows a use or assignment of that variable. Standard library unittest.py, a unit testing framework by Steve Purcell (PyUNIT, inspired by JUnit), is now part of the standard library. You now have a choice of two testing frameworks: unittest requires you to write testcases as separate co...
If you didn't find what you need, try your search in the Python language documentation.