An "adapter", superset of an iterator

2023-05-03 Thread fedor tryfanau
I've been using python as a tool to solve competitive programming problems for a while now and I've noticed a feature, python would benefit from having. Consider "reversed(enumerate(a))". This is a perfectly readable code, except it's wrong in the current version of python. That's because enumerate

Re: where do my python files go in linux?

2008-01-12 Thread Faber J. Fedor
sense. > Thanks for any advice or maybe a good tutorial how to set up files in > a linux environment http://www.pathname.com/fhs/ (couldn't find a more recent version, sorry.) -- Regards, Faber Fedor President Linux New Jersey, Inc. 908-320-0357 800-706-0701 http://www.linuxnj.com

Re: Newbie Q: modifying SQL statements

2008-01-11 Thread Faber J. Fedor
On 12/01/08 00:23 +0100, Hrvoje Niksic wrote: > "Faber J. Fedor" <[EMAIL PROTECTED]> writes: > > Does this '("" if not where...' syntax actually work? > > http://docs.python.org/whatsnew/pep-308.html C'mon! I'm in Day Two of learning

Re: Newbie Q: modifying SQL statements

2008-01-11 Thread Faber J. Fedor
On 11/01/08 18:29 -0500, Mike Meyer wrote: > It is a 2.5 feature, though. I was beginning to wonder of that was the case. > I converted all my clients to 2.5.1, > shortly after it was available, and haven't used anything older > since. Sorry 'bout that. No prob. --

Re: Newbie Q: modifying SQL statements

2008-01-11 Thread Faber J. Fedor
o successful). I ended up changing that line to: q = "select * from %s" % (self.name,) if where: q += "where %s" %where > for r in self.dbc.iterresults() # I assume it has something like this I don't think it does, if I read http://dustman.net/andy/py

Newbie Q: modifying SQL statements

2008-01-10 Thread Faber J. Fedor
Hi all, I'm in the process of learning Python by writing a job queue program. Nothing fancy, mind you, just read from a table, shell out to a program, write back to the table. I'm working off of the tutorial listed here (amongst many places): http://www.devx.com/dbzone/Article/22093 In my Jobs c

Re: mysqldb issue

2005-03-11 Thread fedor
inds on its assigned port. That was it. Also changing '127.0.0.1' to 'localhost' solves the problem. Thanks. Fedor -- http://mail.python.org/mailman/listinfo/python-list

mysqldb issue

2005-03-10 Thread fedor
quot;, line 41, in _make_connection apply(super(ConnectionBase, self).__init__, args, kwargs) _mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' (99)") ''' Does anybody know how to solve this issue? System: Suse 8.1, mysql 4.0.14, mysqldb 1.0.1, python2.3 Thanks very much. Fedor -- http://mail.python.org/mailman/listinfo/python-list

Re: MySQLdb

2005-01-27 Thread fedor
Hi Daniel, You should probably take a look at the executemany method of the cursor. Your insert times might drop by a factor 20 . Here's an example. Cheers, Fedor import time import MySQLdb db=MySQLdb.Connect(user="me",passwd="my password",db="test") c=db.cu

pickling a subclass of tuple

2005-01-01 Thread fedor
Hi all, happy new year, I was trying to pickle a instance of a subclass of a tuple when I ran into a problem. Pickling doesn't work with HIGHEST_PROTOCOL. How should I rewrite my class so I can pickle it? Thanks , Fedor #!/usr/bin/env python import pickle class A(tuple): def __new__(