On 01/-10/-28163 02:59 PM, rantingrick wrote:
On Oct 3, 2:14 pm, Dave Angel<da...@ieee.org>  wrote:

Like it or not, there are plenty of globals already there, one of them
being __name__ .  All the built-ins are effectively global, and so
   is any function they define at top-level.
I keep wondering if that was another PyWart? I believe (and hindsight
is 20-20) that all the built-in modules

There's only one __builtins__ module, which is implicitly loaded, and contains tons of things which are effectively global, such as open, float, filter, sorted, etc.

  should have been protected by
a top-level namespace. Something succicent, something like "py"...

from py.archive import zipfile, tarfile
from py.gui import Tkinter
from py.markup import HTMLParser

...and voila, no more clashes with user defined modules!

Gee, you just described a package. So why not say that the stdlib should have been done as a package of modules ? I don't know if I agree or not, just trying to keep things level.
  Likewise any top-level
class, and any symbols imported with import or with from/import.  So I
consider it impractical for the language to do something that
self-discipline is required for.
Also for scoping.

py>  count =
py>  def foo():
...     global.count +=
py>  print count
1

Why? Well because many times i find myself wondering if this or that
variable is local or global -- and when i say "global" i am speaking
of module scope! The "global<DOT>" cures the ill.

DaveA
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to