Easter Eggs

Gerhard =?unknown-8bit?Q?H=E4ring?= gh_pythonlist at gmx.de
Tue Apr 9 20:44:57 EDT 2002


* Lulu of the Lotus-Eaters <mertz at gnosis.cx> [2002-04-09 18:22 -0400]:
> Who can tell me what's in there.  Someone on c.l.py recently let drop
> the hint about finding the Zen of Python at the interactive prompt in
> 2.2.  I went so far as trying the command in Python versions 1.51, 1.52,
> 2.0, 2.1, 2.2 (it's only in 2.2)... but then promptly forgot what the
> magic command was.  Can someone remind me, please?

In fact, you need the CVS version. Here's the patch:

diff -r python.orig/dist/src/Include/compile.h python/dist/src/Include/compile.h
36a37
> #define CO_ENLIGHTENMENT 0x0040
76a78
> #define FUTURE_ENLIGHTENMENT "enlightenment"
diff -r python.orig/dist/src/Lib/__future__.py python/dist/src/Lib/__future__.py
50a51
>     "enlightenment",
64a66
> CO_ENLIGHTENMENT     = 0x4000   # enlightenment
104a107,110
> 
> enlightenment = _Feature((2, 3, 0, "alpha", 0),
>                          (2, 3, 0, "alpha", 1),
>                          CO_ENLIGHTENMENT)
diff -r python.orig/dist/src/Python/future.c python/dist/src/Python/future.c
36a37,38
>                 } else if (strcmp(feature, FUTURE_ENLIGHTENMENT) == 0) {
>                     printf("You are enlightened.\n");

I won't publish the patch of the additional Python features that are
only available when CO_ENLIGHTENMENT is set ;-)

Now you can do:

bash-2.05$ ./python
Python 2.3a0 (#1, Apr 10 2002, 02:29:51)
[GCC 2.95.3 20010315 (release) [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import enlightenment
You are enlightened.

Now you may wonder how it makes a difference to you that you actually
got enlightened. Guess that's a tough question for a Zen master, too.

Gerhard
-- 
This sig powered by Python!
Außentemperatur in München: 2.8 °C      Wind: 3.5 m/s





More information about the Python-list mailing list