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
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 cla
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, kw
> 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
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
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
succes
> 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 exampl
This is on:
Python 2.5 (r25:51908, Oct 19 2007, 09:46:41)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2
Redhat Fedora release 7 (Moonshine)
x86 64 bit processor (SMP)
> The program worked fine for me (python 2.5.1 - stackless on
> Mac OSX). Can you provide details about your platform (pytho
the following error:
12 [main] python2.5 2700 _cygtls::handle_exceptions: Error while
dumping state (probably corrupted stack)
> -Original Message-
> From: Orest Kozyar [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 31, 2007 4:27 PM
> To: 'Aditya Lal'
>
> 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 comp.lang
11 matches
Mail list logo