It appears you have a cyclic reference in your doc object.
Try adding doc.unlink() before you add it to your shelf.
That fixed the problem. I did not realize that XML documents could have
cyclic references. Thanks for all your help!
Orest
___
It appears you have a cyclic reference in your doc object.
Try adding doc.unlink() before you add it to your shelf.
Actually, I just realized that doc.unlink() seems to delete the entire XML
content, which kind of defeats the purpose of caching it. I'll check on
xml-sig and the
I have a program which queries an online database (Medline) for XML data.
It caches all data using shelve to avoid hitting the database too many
times. For some reason, I keep getting a RuntimeError: maximum recursion
depth exceeded when attempting to add a certain record. This program has
Please post the entire traceback (omitting duplicate lines).
Sorry, I should have included the traceback. I've revised the sample script
so that it generates the traceback when run. The sample script is at the
very bottom of this email.
### SCRIPT OUTPUT ###
[kozyar]:~$ python
Given a variable x that can either be None or a tuple of two floats [i.e.
(0.32, 4.2)], which syntax is considered most appropriate under Python
coding standards?
if x and x[0] 0:
pass
=OR=
if x:
if x[0] 0:
pass
In the first, I'm obviously making the
This could be written
kwargs.update(zip(argnames, args))
Nice trick! Thanks for the pointer.
return type.__call__(cls, kwargs)
You are passing kwargs as a positional argument to __call__(); i.e.
passing the dict as an ordinary parameter. To use kwargs as
the keyword
I have the following code:
class meta(type):
def __call__(cls, *args, **kwargs):
argnames = inspect.getargspec(cls.__init__)[0]
for i, value in enumerate(args):
kwargs[argnames[i]] = value
return type.__call__(cls,
I'm trying to follow the example listed in the wiki at
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/UniqueObject regarding the
use of a metaclass.
What I don't understand is how the metaclass (EntitySingleton) has access to
the variable ctx which is instantinated outside the scope of the
I've got a 2D list (essentially a list of lists where all sublists are of
the same length). The sublists are polymorphic. One 2D list I commonly
work with is:
[ [datetime object, float, int, float],
[datetime object, float, int, float],
[datetime object, float, int, float] ]
I'd like to be