Object Database (ODBMS) for Python

Jeremy Bowers jerf at jerf.org
Thu Aug 28 22:07:31 EDT 2003


On Thu, 28 Aug 2003 20:26:41 -0500, Patrick K. O'Brien wrote:
>>>> u1.name
> 'Bob'
>>>> u1.name = 'Joe'
> Traceback (most recent call last):
>   File "<input>", line 1, in ?
>   File "/home/pobrien/Code/pypersyst/entity/entity.py", line 94, in
>   __setattr__
>     raise AttributeError, 'Modifications can only be made by transactions'
> AttributeError: Modifications can only be made by transactions
> 
> So, let's use a transaction:

So why *isn't* it a transaction? Unless you have a good reason not to, I'd
suggest automatically "coercing" that into a transaction instead of
throwing an error.

Give an indication in the docs about the performance issues if you like,
but make the trivially easy case easy.

(I'm only really entering my maturity (IMHO) as a software engineer, but
one of my rules of thumb for developing software for other people to use
is that the API can ***never*** be too easy. Doing something hard may be a
little tricky but if you can make the easy case still work, you're way
ahead. And Python is one ass-kicking language in that regard; it's one of
the reasons I love it so much, the APIs can be made so easy to use they
sometimes fade into complete transparency, like "u1.name = 'joe'". (I've
been focusing on how to write APIs for others to use, esp. in Open Source
though it applies equally to any team effort, that will be successful,
rather then ignored.))




More information about the Python-list mailing list