In article <814f91a3-faa4-4473-b28f-8e0e217fb...@f33g2000vbf.googlegroups.com>,
odeits wrote:
>
>for row in rows:
>ad = dict()
Micro-optimization:
ad = {}
--
Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/
"Programming language design is not a rational sci
On Mar 9, 1:06 am, Dennis Lee Bieber wrote:
> On Sun, 8 Mar 2009 19:07:08 -0700 (PDT), odeits
> declaimed the following in gmane.comp.python.general:
>
>
>
> > i get this error when running that query:
>
> > sqlite3.OperationalError: LIMIT clause should come after UNION not
> > before
>
>
On Mar 8, 12:31 pm, Dennis Lee Bieber wrote:
> On Sat, 7 Mar 2009 23:07:55 -0800 (PST), odeits
> declaimed the following in gmane.comp.python.general:
>
>
>
>
>
> > For those of you who asked about the SQL the full function is here.
> > The connection is to a sqlite database with the row_factory
On Mar 8, 11:31 am, Dennis Lee Bieber wrote:
> On Sat, 7 Mar 2009 23:07:55 -0800 (PST), odeits
> declaimed the following in gmane.comp.python.general:
>
>
>
>
>
> > For those of you who asked about the SQL the full function is here.
> > The connection is to a sqlite database with the row_factory
On Mar 8, 4:48 am, "andrew cooke" wrote:
> odeits wrote:
> > On Mar 7, 1:07 pm, Scott David Daniels wrote:
> >> odeits wrote:
> >> > I am looking to clean up this code... any help is much appreciated.
> >> > Note: It works just fine, I just think it could be done cleaner.
>
> >> > The result is a
andrew cooke wrote:
> odeits wrote:
>> On Mar 7, 1:07 pm, Scott David Daniels wrote:
>>> odeits wrote:
>>> > I am looking to clean up this code... any help is much appreciated.
>>> > Note: It works just fine, I just think it could be done cleaner.
>>>
>>> > The result is a stack of dictionaries. t
odeits wrote:
> On Mar 7, 1:07 pm, Scott David Daniels wrote:
>> odeits wrote:
>> > I am looking to clean up this code... any help is much appreciated.
>> > Note: It works just fine, I just think it could be done cleaner.
>>
>> > The result is a stack of dictionaries. the query returns up to
>> >
On Mar 7, 10:58 pm, odeits wrote:
> On Mar 7, 1:07 pm, Scott David Daniels wrote:
>
>
>
> > odeits wrote:
> > > I am looking to clean up this code... any help is much appreciated.
> > > Note: It works just fine, I just think it could be done cleaner.
>
> > > The result is a stack of dictionaries.
On Mar 7, 1:07 pm, Scott David Daniels wrote:
> odeits wrote:
> > I am looking to clean up this code... any help is much appreciated.
> > Note: It works just fine, I just think it could be done cleaner.
>
> > The result is a stack of dictionaries. the query returns up to
> > STACK_SIZE ads for a u
odeits wrote:
I am looking to clean up this code... any help is much appreciated.
Note: It works just fine, I just think it could be done cleaner.
The result is a stack of dictionaries. the query returns up to
STACK_SIZE ads for a user. The check which i think is very ugly is
putting another con
Martin P. Hellwig wrote:
while I am at it :-)
if ignore == False:
is probably cleaner when written
if not ignore:
--
mph
--
http://mail.python.org/mailman/listinfo/python-list
Martin P. Hellwig wrote:
def query_parser(QUERY, USER, STACK_SIZE):
indexes = ['ni','adid','rundateid','rundate','city','state','status']
empty = 'None'
stack = []
query_result = self.con.execute(QUERY,(USER,STACK_SIZE)).fetchall()
ni = indexes[0]
for row in query_resul
odeits wrote:
I am looking to clean up this code... any help is much appreciated.
Note: It works just fine, I just think it could be done cleaner.
The result is a stack of dictionaries. the query returns up to
STACK_SIZE ads for a user. The check which i think is very ugly is
putting another con
ah, yes, i didn't see that clearly. in this case it might be better to have:
def copy(src, dst, name, null):
value = src[name]
dst[name] = null if value is None else value
and then make it explicit in both cases:
copy(row, ad, name, null=None)
...
copy(row, ad, name, null='None')
andrew
Pa
odeits wrote:
I am looking to clean up this code... any help is much appreciated.
Note: It works just fine, I just think it could be done cleaner.
The result is a stack of dictionaries. the query returns up to
STACK_SIZE ads for a user. The check which i think is very ugly is
putting another con
"andrew cooke" writes:
> def copy(src, dst, name, quote_none=False):
> value = src[name]
> dst[name] = 'None' if quote_none and value is None else value
def copy(src, dst, name, default=None):
value = src[name]
dst[name] = value if value is not None else default
> copy(row, ad, name,
Thanks a lot! that copy function is a really neat trick!
Yes the ni's are sorted, and yes the query SHOULD be the one to limit it to
just one set of ni's; however, i am having trouble implementing that in sql.
I am using sqlite3 atm and right now i have a very large select statment the
gets me wha
odeits wrote:
> I am looking to clean up this code... any help is much appreciated.
> Note: It works just fine, I just think it could be done cleaner.
>
> The result is a stack of dictionaries. the query returns up to
> STACK_SIZE ads for a user. The check which i think is very ugly is
> putting an
I am looking to clean up this code... any help is much appreciated.
Note: It works just fine, I just think it could be done cleaner.
The result is a stack of dictionaries. the query returns up to
STACK_SIZE ads for a user. The check which i think is very ugly is
putting another contraint saying th
19 matches
Mail list logo