disenchanted java user mumbles newbie questions

Tim Peters tim_one at email.msn.com
Sat Apr 3 01:26:17 EST 1999


[Alex Rice]
> 1) In the Python 1.5 Tutorial, sec. 9.2 "Python Scopes and Name Spaces"
> there is the following passage:

> ...
> -- however, the language definition is evolving towards static name
> resolution, at ``compile'' time, so don't rely on dynamic name
> resolution!
> ...

> Where can I read more about this move towards for compile time, static
> name resolution and the reasons for it.

Best I can suggest is scouring years' worth of DejaNews.  Most of it is
summarized in early postings to the Python Types-SIG, though
(http://www.python.org/, and follow the SIGS link at the top ...).

"The reasons" are the same as everyone else's:  a mix of efficiency and
compile-time-checked type safety.  I'd say the Python thrust these days may
be more toward adding *optional* type decls, though.  OTOH, nothing has
changed in this area of Python for > 5 years, so don't panic prematurely
<wink>.

> For some reason I was envisioning Python as being less like Java and
> more like Objective-C or Smalltalk in terms of dynamic binding.

Yes, it is.  It's extreme, though.  For example, in

def sumlen(a, b, c):
    return len(a) + len(b) + len(c)

Python can't assume that "len" refers to the builtin function "len", or even
that all three instances of "len" refer to the same thing within a single
call (let alone across calls).  As to what "+" may mean here, it's even
hairier.  In effect, the current semantics require that Python look up every
non-local name and access path from scratch every time it (dynamically) hits
one.

This leads to some pretty disgusting convolutions for speeding "inner
loops", in support of a generality that's wonderful to have but actually
*needed* by very little code.  Because of a professional background in
compiler optimization, I'm supposed to be appalled by this <wink>.

> 2) Which reminds me: does anyone have a URL for that Ousterhut (sp?)
> article at Sunlabs about Scripting languages and why scripting rulz and
> where he has a taxonomy of programming languages along 2 dimensions?
> Lost that bookmark and cannot find it again.

It's one of the White Papers at:

    http://www.scriptics.com/scripting/white.html


> 3) What's the Python equivalent of depends.exe? --something to find what
> modules your script is depending upon?

Suggest searching python.org and DejaNews and Starship for "freeze" and
"squeeze".

> It seems like one would be able to create a very slim distribution if one
> needed an .exe, couple of .dll only a handful of .py files.

Why do I suspect you're a Windows programmer <wink>?  The most advanced
Python distribution system for Win32 is likely Gordon McMillan's, available
for free at

    http://www.mcmillan-inc.com/install.html

May also want to visit the Python DistUtils SIG.

> A Java+Swing application can be 1-2 MB not including the VM! bloat--ed.

Doubt you're going to get off much cheaper with Python + Tcl/Tk, although it
includes two complete language implementations.

> What's a typical size of a bare-bones Python distribution?

Download one, unpack it, and do "dir" <wink>.

soon-even-light-bulbs-will-have-20Gb-hard-drives-ly y'rs  - tim






More information about the Python-list mailing list