To 'with' or not to 'with': how is the question ?

Jason Cunliffe jasonic at nomadicsltd.com
Fri Sep 1 15:33:40 EDT 2000


Hello

In ActionScript, JavaScript and VBScript, there is the 'with' operator
torefer to the same piece of code many times..

For example in VBScript:

Set evilcommondocument = CreateObject("Word.Document")

With lovelyobject
    .AutoHyphenation = True
    .PrintPreview
    evilcommondocument.Close
End With

Set evilcommondocument = Nothing

This works for longer more nested objects.properties lumps also, where it is
a very nice feature I find.
In Zope there is also the similar tag <dtml-with> which focuses the
namespace..

How could / would /should  you do you do this in Python?.. or don't you..?
Caveats?

We are working on a project where we are interfacing Flash to Zope via
Python External methods and Berkeley.
Very nice.. As much as possible we are trying to move the end-user logic to
the client where it belongs.
Flash5 is great for this both visually and now script-wise. Zope though
wonderful in some respects [ZODB yes] is a concept based on constant server
access. Experience with hideous DTML and its impossible documentation, has
further encouraged us to avoid Zope-side scripting as much as possible, and
just enjoy its other excellent features. Python External methods I like very
much - you don't have to start the !@$# server and source updates are fast
because the dtml methods are only links not objects.

To speed up workflow and development I am looking for ways to make code on
both client and server to be as easy as possible to read and maintain. This
means reducing typing, aiming for more symmetrical code style etc.. Not
fanatical, just seeking a saner work base for the next year of project
development. ActionScript [in latest version Flash 5] is now partly ECMA-262
compliant.. reads just like JavaScript].


Thanks
- Jason

________________________________________________________________
Jason CUNLIFFE = NOMADICS.(Interactive Art and Technology).Design Director






More information about the Python-list mailing list