This is the mail archive of the xconq7@sources.redhat.com mailing list for the Xconq project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

OT Python stuff (was RE: Python in Xconq)


>>>>> "Erik" == Erik Jessen <ejessen@adelphia.net> writes:
Erik> 
Erik> Perl has all that as well - I know, because I use them on a regular
Erik> basis.  Also, there are a great many modules others have written, to
Erik> enable things like network play (RPC/IPC/IRC/etc.).
Erik> 
Erik> But again, I've not seen Python, so it may do all those things in a
Erik> much nicer way.

My running joke is that Python has a very simple syntax while Perl has a
shitload of syntaxes.  If you know C, C++, or Java, you won't find very
many syntax surprises in Python.  You can write a lot of code without using
any of the Python "odd" constructions.

Even so, you can write such gems as...

dirList = [ [k , v] for (k, v) in tmap.iteritems()]

...which converts a hashmap of tuples into a list of lists or ...

        webClientDirs = [os.path.join("com", "mycompany", "argle", "cap", "web", "ua", "base", "session"),
                         os.path.join("com", "mycompany", "argle", "cap", "web", "ua", "pca", "appl"),
                         os.path.join("com", "mycompany", "argle", "foundation", "awt", "layout"),
                         os.path.join("com", "mycompany", "argle", "base", "ccpe", "base"),
                         os.path.join("com", "mycompany", "argle", "base", "ccpe", "events"),
                         os.path.join("com", "mycompany", "argle", "base", "ccpe", "model"),
                         os.path.join("com", "mycompany", "argle", "base", "ccpe", "type"),
                         os.path.join("com", "mycompany", "argle", "mw", "gui"),
                         os.path.join("com", "mycompany", "argle", "mw", "sdp", "jni"),
                         os.path.join("com", "mycompany", "bargle", "base")
                         ]
        
        fulldirs = map(lambda x: os.path.join(self.config.compileDest, x), webClientDirs)

...which created a list of subdirectories (in a cross-platform fashion) and
then prepends a root directory to each element of the list producing
another list for later processing.

http://www.linuxjournal.com/article.php?sid=3882 is written by the guy that
wrote fetchmail.  Worth a read.


-- 
 Mark A. Flacy
 Any opinions expressed above are my own.  Any facts expressed above
 would imply that I know what I'm writing about.  Sometimes, I do!
"Just because you're paranoid doesn't mean they aren't out to get you
 anyways."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]