Confused by List behavior

Moshe Zadka moshez at
Thu Apr 20 09:34:07 EDT 2000

On Thu, 20 Apr 2000 ejbaker_seekonk at wrote:

> As a python newbie, I entered this script to explore list processing
> behaviours.
> yy = dir()
> for element in yy:
>   print element
> for element in yy:
>   print dir(element)
> The first 'for' loop works as expected. It returns,
> ['__builtins__', '__doc__', '__name__'].
> The second loop, however, returns three empty lists. For the life of
> me, I can't understand that. Becauese, if I type 'dir(__builtins__)',
> in a script, I get all of the elements of __builtins__.
> Can anyone explain this?

Hint: what happens if you type dir('__builtins__')?

thank-god-this-isn't-tcl-ly y'rs, Z.
Moshe Zadka <mzadka at>. -- we put the penguin in .com

More information about the Python-list mailing list