[Pythonmac-SIG] advanced newbie questions

Nicholas Riley njriley at uiuc.edu
Tue Jan 27 15:49:18 EST 2004


On Tue, Jan 27, 2004 at 11:58:48AM -0700, steve harley wrote:
> i'm learning Python, evaluating it for replacing a workflow that is now  
> half in Visual FoxPro, half in UserLand Frontier (running in Virtual PC  
> & Classic respectively under Mac OS X 10.3.2).. given that i find both  
> of those environments very fluid and powerful, but dislike having to  
> use VPC and Classic, Python looks very promising.. it has a coding feel  
> much like Frontier, though i miss coding in an outliner; has anyone  
> found a way to do this for Python, which is so obviously suited?

I wish.  There are a few editors based on Scintilla which provide code
folding, but it's nothing like Frontier's outline-based editing.

I really miss Frontier, but at least on the Mac, current versions of
Frontier/Radio are buggy and poorly maintained (if at all).  I've
moved off it, mainly to Python.  A few years ago, around Python
1.5.2/2.0, I wrote an application which was half in Python, using ZODB
and Tkinter, and half in Radio (back when it was free), using XML-RPC
for communication.  The main reason for this was that I couldn't find
a scriptable outliner for Python half as good as Radio's.
Unfortunately, nothing has changed since then.

> for relational purposes, easiest for me would be SQL back end; bearing  
> in mind i'm used to completely integrated, inline SQL, with little  
> fiddling or setup required, are there any gotchas or strong positives  
> (from the Python on Mac OS X perspective) for MySQL or Postgres? is  
> there some other approach which would let me do complex joins and  
> many-to-many relations?

Two Python apps I'm currently maintaining use Metakit and MS SQL
Server for data storage.  Obviously the latter is not a good choice
for the Mac - I am using ADODBAPI on Windows, in fact :).  Python has
a standard, easy-to-use database API; I hope the multitude of bugs in
ADODAPI I've found aren't shared by the interfaces to PostgreSQL.
(MySQL is a bad choice overall, especially with the recent licensing
changes).

Metakit is a relational-ish database with the ease of construction of
an object database.  It doesn't really lend itself to the hierarchical
design you'd find in Frontier's ODB, but it's good for small to medium
size data sets (since it uses memory mapping for speed) and has a
great Python binding on which I've done some work.

> for object storage, i get the impression there are various "object  
> serialization" approaches.. since i'd probably eventually use PyObjC to  
> build interfaces, i'd also consider a Cocoa-based approach.. from  
> either the pure Python or Cocoa sides, is there one that stands out?  
> what are the performance considerations? (most of my objects are  
> probably smaller than 10KB)

If you choose to go with ZODB, be careful.  ZODB's paradigm is much
closer to Frontier's ODB: it's extremely hierarchical and doesn't
really like to make arbitrary connections, unlike true object-oriented
databases (e.g. ObjectStore).  But by storing objects rather than a
limited set of data types - I like to think of Frontier's ODB as what
the Mac Resource Manager would be like if it became a database - it's
not so hard to corrupt your data store in subtle and confusing ways.
Just don't expect it to handle indexing well.

> for either of these storage needs, are there good abstraction libraries  
> so that i could switch storage types later if needed?

There are a few, but I haven't found any higher-level database
abstraction layers in Python robust enough to use.

You might also consider Squeak Smalltalk (www.squeak.org).  I learned
Frontier before Smalltalk, and Smalltalk environments are the closest
I've found to the immersive development experience of Frontier.  GLORP
(www.glorp.org) is an object-relational persistence layer which I used
in a much more primitive version, and it looks pretty decent now
despite the version number.  GLORP works with Oracle and PostgreSQL.

-- 
=Nicholas Riley <njriley at uiuc.edu> | <http://www.uiuc.edu/ph/www/njriley>



More information about the Pythonmac-SIG mailing list