In Python 2.4a3 (to be released this Thursday), everything remains as currently in CVS. For 2.4b1, I will consider a change of @ to some other single character, even though I think that @ has the advantage of being the same character used by a similar feature in Java. It's been argued that it's not quite the same, since @ in Java is used for attributes that don't change semantics. But Python's dynamic nature makes that its syntactic elements never mean quite the same thing as similar constructs in other languages, and there is definitely significant overlap. Regarding the impact on 3rd party tools: IPython's author doesn't think there's going to be much impact; Leo's author has said that Leo will survive (although it will cause him and his users some transitional pain). I actually expect that picking a character that's already used elsewhere in Python's syntax might be harder for external tools to adapt to, since parsing will have to be more subtle in that case. But I'm frankly undecided, so there's some wiggle room here. I don't want to consider further syntactic alternatives at this point: the buck has to stop at some point, everyone has had their say, and the show must go on.
In 1890, the Parisian painter Maurice Denis famously asserted: "Remember that a painting—before being a warhorse, a naked woman or some story or other—is essentially a flat surface covered with colors assembled in a certain order." Thus, many 20th-century developments in painting, such as Cubism, were reflections on the means of painting rather than on the external world—nature—which had previously been its core subject. Recent contributions to thinking about painting have been offered by the painter and writer Julian Bell. In his book What is Painting?, Bell discusses the development, through history, of the notion that paintings can express feelings and ideas. In Mirror of The World, Bell writes:
The invention of photography had a major impact on painting. In the decades after the first photograph was produced in 1829, photographic processes improved and became more widely practiced, depriving painting of much of its historic purpose to provide an accurate record of the observable world. A series of art movements in the late 19th and early 20th centuries—notably Impressionism, Post-Impressionism, Fauvism, Expressionism, Cubism, and Dadaism—challenged the Renaissance view of the world. Eastern and African painting, however, continued a long history of stylization and did not undergo an equivalent transformation at the same time.
Decorator Abstractions: A decorator abstraction is an abstract class that implements the component interface. Critically, the decorator abstraction must also contain a pointer to some instance of the same interface. Inside the decorator abstraction, each of the component interface behaviors will be delegated to whichever concrete component the pointer indicates.
To calculate the tenth Fibonacci number, you should really only need to calculate the preceding Fibonacci numbers, but this implementation somehow needs a whopping 177 calculations. It gets worse quickly: 21891 calculations are needed for fibonacci(20) and almost 2.7 million calculations for the 30th number. This is because the code keeps recalculating Fibonacci numbers that are already known.
Using functions with "action-at-a-distance" through sys.settraceback may be okay for an obscure feature that can't be had any other way yet doesn't merit changes to the language, but that's not the situation for decorators. The widely held view here is that decorators need to be added as a syntactic feature to avoid the problems with the postfix notation used in 2.2 and 2.3. Decorators are slated to be an important new language feature and their design needs to be forward-looking, not constrained by what can be implemented in 2.3.
A still life is a work of art depicting mostly inanimate subject matter, typically commonplace objects—which may be either natural (food, flowers, plants, rocks, or shells) or man-made (drinking glasses, books, vases, jewelry, coins, pipes, and so on). With origins in the Middle Ages and Ancient Greek/Roman art, still life paintings give the artist more leeway in the arrangement of design elements within a composition than do paintings of other types of subjects such as landscape or portraiture. Still life paintings, particularly before 1700, often contained religious and allegorical symbolism relating to the objects depicted. Some modern still life breaks the two-dimensional barrier and employs three-dimensional mixed media, and uses found objects, photography, computer graphics, as well as video and sound.
Decorator Abstractions: Our decorator abstraction takes the form of the abstract MessageDecorator class, which also implements IMessage. The MessageDecorator class has a constructor that accepts an IMessage object as a parameter and then assigns it to a private variable. For its part, MessageDecorator doesn’t have any special behaviors and simply delegates GetMessage and PrintMessage calls to whichever IMessage object was injected into it.
Water miscible oil paints (also called "water soluble" or "water-mixable") is a modern variety of oil paint engineered to be thinned and cleaned up with water, rather than having to use chemicals such as turpentine. It can be mixed and applied using the same techniques as traditional oil-based paint, but while still wet it can be effectively removed from brushes, palettes, and rags with ordinary soap and water. Its water solubility comes from the use of an oil medium in which one end of the molecule has been altered to bind loosely to water molecules, as in a solution.
This code works for our purposes but it’s not exactly dynamic. If we wanted our initial simpleMsg object to sometimes act excited and sometimes quizzical, we could only do so by instantiating entirely new objects from the relevant subclass. Moreover, the ExcitedAndQuizzicalMessage is really just a combination of ExcitedMessage and QuizzicalMessage and probably shouldn’t have its own class. To fix these problems, let’s now return to the decorator pattern and see how it might help us.
Did you get it? We just applied the previously learned principles. This is exactly what the decorators do in Python! They wrap a function and modify its behaviour in one way or the another. Now you might be wondering that we did not use the @ anywhere in our code? That is just a short way of making up a decorated function. Here is how we could have run the previous code sample using @.