Python vs Java garbage collection?

"Martin v. Löwis" martin at v.loewis.de
Mon Dec 23 05:50:05 EST 2002


Erik Max Francis wrote:
>>If you were just to use what the language
>>definition guarantees you, you could not write a single useful
>>application.
> 
> 
> Huh?  Presuming by "language definition" you mean the documentation
> available at python.org, I don't see how this comment makes sense.

There is a number of things that you cannot strictly rely on. For 
example, there is no guarantee that "Hello" is a valid string literal - 
parsing it may cause a MemoryError, if the machine has not sufficient 
memory to represent the literal. Likewise, 42L may not be a valid long 
integer literal. There is a (near) guarantee that integer literals can 
be up to 2147483647 (although it strictly speaking does not guarantee 
this), see

http://www.python.org/doc/current/ref/integers.html

but there is no guarantee for long literals - anything may be 
constrained by "available memory". So an implementation that gives a 
MemoryError on 42L would be, strictly speaking, conforming.

Going on to the library, there is, strictly speaking, no guarantee that 
you can use files. It says a filename is passed to stdio's fopen, which, 
in turn, gives no guarantee that there is a single valid file name on a 
system, let alone guaranteeing that "foo.txt" is a valid file name.

So you can't use files, long integers, and strings; pretty useless 
language, I'd say :-)

Regards,
Martin




More information about the Python-list mailing list