Mailing List Archive

disenchanted java user mumbles newbie questions
Hola,

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

>>
It is important to realize that scopes are determined textually: the
global scope of a function defined in a module is that module's name
space, no matter from where or by what alias the function is called. On
the other hand, the actual search for names is done dynamically, at run
time -- however, the language definition is evolving towards static name
resolution, at ``compile'' time, so don't rely on dynamic name
resolution! (In fact, local variables are already determined
statically.)
>>

Where can I read more about this move towards for compile time, static
name resolution and the reasons for it. For some reason I was
envisioning Python as being less like Java and more like Objective-C or
Smalltalk in terms of dynamic binding.

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.

3) What's the Python equivalent of depends.exe? --something to find what
modules your script is depending upon? 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. A Java+Swing application can be 1-2 MB not
including the VM! bloat--ed. What's a typical size of a bare-bones
Python distribution? Obviously the thread in this group "Free commercial
Python application" is not representative... I hope.

TIA!

Alex Rice -- MindLube Software
disenchanted java user mumbles newbie questions [ In reply to ]
[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
disenchanted java user mumbles newbie questions [ In reply to ]
Tim Peters wrote:
[tons of excellent pointers]

> Why do I suspect you're a Windows programmer <wink>?

Thanks for all the suggestions. Python rocks. I really like wxPython
too.

As far as me being a Windows programmer, well not really. I'm equally at
home thrashing around in Windows and Unix. In fact this evening I
discovered your python-mode.el. What a great Emacs mode!

Thanks again,

Alex Rice -- MindLube Software