On 1/22/07, Gert Cuykens <[EMAIL PROTECTED]> wrote: > On 1/22/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > "Gert Cuykens" <[EMAIL PROTECTED]> escribió en el mensaje > > news:[EMAIL PROTECTED] > > > > > class Db: > > > > > > _db=-1 > > > _cursor=-1 > > > > > > @classmethod > > > def __init__(self,server,user,password,database): > > > self._db=MySQLdb.connect(server , user , password , database) > > > self._cursor=self._db.cursor() > > > > > > @classmethod > > > def excecute(self,cmd): > > > self._cursor.execute(cmd) > > > self._db.commit() > > > > > > > > > if __name__ == '__main__': > > > gert=Db('localhost','root','******','gert') > > > gert.excecute('select * from person') > > > for x in range(0,gert.rowcount): > > > print gert.fetchone() > > > gert.close() > > > > Besides your specific question that was already answered, why are you using > > classmethods at all? > > You are constructing a Db instance and using it as if all were normal > > instance methods... Just remove all those @classmethod declarations and use > > it in a standard way. > > > > -- > > Gabriel Genellina > > > > > > -- > > http://mail.python.org/mailman/listinfo/python-list > > > > i thought @classmethod was the normal method ? >
did some reading and i think i know why now :) http://www.faqts.com/knowledge_base/view.phtml/aid/16824 python always seems to amaze me how other languages make a mess of things that suppose to be simple -- http://mail.python.org/mailman/listinfo/python-list