[Tutor] telling dir(_builtins_) from dir(__builtins__)
alan.gauld@bt.com
alan.gauld@bt.com
Sun, 17 Mar 2002 23:47:47 -0000
> How in the heck is a Newwbie to know dir(_builtins_)
> from dir(__builtins__)?!? both look like one hypen to me.
> I have been working in Alan Gaulds book and ... don't
> recall reading about this distinction.
Assuming its the dead tree version you find it mentioned
in the footnote on page 51 regarding the __init__() method.
It specifically says you need two underscores at each end.
Then again on page 79 discussing dir(__builtins__) the
footnote remarks that "Many special names exist in Python,
most of which are marked by this double underscore naming
style"
So I did try... but I guess you could interpret a single
underscore at each end as being a double underscore
convention. If so sorry, I couldn't think of a clearer
way to express it.
> exactly the kind of tedious dotting your I's and crossing
> your T's that drove me nuts years ago when I tried to
> learn basic but gave up.
As I repeatedly remark in my book - computers are stupid.
You have to be specific and precise. These are the
irritations of every programming language, sorry, but that's
just how it is. Eventually siomebody might figure out how
to make smarter interpreters, until then we're stuck with it.
Alan G