SV: Python Productivity over C++

Michael Hudson mwh21 at cam.ac.uk
Wed Jun 14 20:02:33 EDT 2000


Moshe Zadka <moshez at math.huji.ac.il> writes:

> On Wed, 14 Jun 2000, Eric Lee Green wrote:
> 
> > Michal Vitecek wrote:
> > >  this is highly debatable - properly written C/C++ source is pretty well
> > >  readable and self-documenting. similarly, badly written python source
> > >  makes it as unreadable as in other languages - there's not a point in
> > >  trying to prevent people from writing (un)readable source code.
> > 
> > It's harder to write unreadable Python source because you can't write code
> > like, hmm,
> > 
> > opendir(FOO,\"%s\");@files=readdir(FOO);foreach (@files) { if
> > (/^[^\\.].*\\.txt$/) { print \"%s/$_\\n\";};};closedir(FOO);
> 
> import os,re
> for _ in os.path.listdir("%s"): if re.match("^[^.].*\.txt$': print(
> "%%s/%(_)s" % vars())

But that doesn't work:

>>> for _ in os.path.listdir("%s"): if re.match("^[^.].*\.txt$': print(
  File "<stdin>", line 1
    for _ in os.path.listdir("%s"): if re.match("^[^.].*\.txt$': print(
                                     ^
SyntaxError: invalid syntax
 
> writing-obfuscated-python-isn't-that-easy-ly y'rs, Z.

Indeed.

or-was-that-your-point-ly y'rs
Michael

-- 
  SCSI is not magic. There are fundamental technical reasons why it
  is necessary to sacrifice a young goat to your SCSI chain now and 
  then.                                                  -- John Woods



More information about the Python-list mailing list