由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
_Python版 - An easter egg in Python :)
相关主题
damn! just found some more "secrets" INSIDE "this"Re: python .pyw问题请教
One question about import exe result to python scriptpython程序运行速度的问题 (转载)
google app engine 里 加载 numpy└ Re: python程序运行速度的问题
如何用 Python 修改 mp3 文件的音乐标题Is it possible to use c++ objects from python code?
请问如何import一个python文件└ Re: Is it possible to use c++ objects from python code?
ploting 3D surface in python (转载)├ Re: Is it possible to use c++ objects from python code?
error draw map from shape file Python 3.2 basemap (转载)└ Re: Re: Is it possible to use c++ objects from python co
Another Easter egg :)))Question about this python error.
相关话题的讨论汇总
话题: python话题: __话题: easter话题: egg话题: dir
1 (共1页)
i*****f
发帖数: 578
1
Try this:
import this
You'll get "Zen of Python". Check it out:)
j*a
发帖数: 14423
2
>>> dir()
['__builtins__', '__doc__', '__name__', '__package__', 'this']

【在 i*****f 的大作中提到】
: Try this:
: import this
: You'll get "Zen of Python". Check it out:)

i*****f
发帖数: 578
3
ActivePython 2.6.4.8 (ActiveState Software Inc.) based on
Python 2.6.4 (r264:75706, Nov 3 2009, 13:23:17) [MSC v.1500 32 bit (Intel)]
on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> dir()
['__builtins__', '__doc__', '__name__', '__package__']
did you do dir() after you've imported "this"?

【在 j*a 的大作中提到】
: >>> dir()
: ['__builtins__', '__doc__', '__name__', '__package__', 'this']

j*a
发帖数: 14423
4
i use p3
# python3
Python 3.1.1 (r311:74480, Aug 29 2009, 16:22:42)
[GCC 4.3.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality bea

【在 i*****f 的大作中提到】
: ActivePython 2.6.4.8 (ActiveState Software Inc.) based on
: Python 2.6.4 (r264:75706, Nov 3 2009, 13:23:17) [MSC v.1500 32 bit (Intel)]
: on
: win32
: Type "help", "copyright", "credits" or "license" for more information.
: >>> dir()
: ['__builtins__', '__doc__', '__name__', '__package__']
: did you do dir() after you've imported "this"?

i*****f
发帖数: 578
5
i meant that before you importing this, you'll not see "this" in dir(),
right?
sorry if i confused you :) I tried to say that if you can see "this" w/o
importing it first (that's even not true for normal modules), then "this"
can't be an easter egg right?

【在 j*a 的大作中提到】
: i use p3
: # python3
: Python 3.1.1 (r311:74480, Aug 29 2009, 16:22:42)
: [GCC 4.3.4] on linux2
: Type "help", "copyright", "credits" or "license" for more information.
: >>> import this
: The Zen of Python, by Tim Peters
: Beautiful is better than ugly.
: Explicit is better than implicit.
: Simple is better than complex.

j*a
发帖数: 14423
6
you are right. 'this' is not in dir() until after it's imported.

【在 i*****f 的大作中提到】
: i meant that before you importing this, you'll not see "this" in dir(),
: right?
: sorry if i confused you :) I tried to say that if you can see "this" w/o
: importing it first (that's even not true for normal modules), then "this"
: can't be an easter egg right?

1 (共1页)
相关主题
Question about this python error.请问如何import一个python文件
精华区里新加了很多东西ploting 3D surface in python (转载)
python有好的免费Linux IDE么?error draw map from shape file Python 3.2 basemap (转载)
新人报道,请问各位大牛如何开始学习python?Another Easter egg :)))
damn! just found some more "secrets" INSIDE "this"Re: python .pyw问题请教
One question about import exe result to python scriptpython程序运行速度的问题 (转载)
google app engine 里 加载 numpy└ Re: python程序运行速度的问题
如何用 Python 修改 mp3 文件的音乐标题Is it possible to use c++ objects from python code?
相关话题的讨论汇总
话题: python话题: __话题: easter话题: egg话题: dir