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?
|
|