[Tutor] python learning

Cedric BRINER work at infomaniak.ch
Thu Jul 28 16:56:43 CEST 2005

I'm learning for almost a year and half python. this is my first language. I'm fine with classes, definition... But now I'm trying to understand better things as:
static method
class method
and the use of metaclass.

Does some one of you knows about a compilations of small snippets showing how things works!
an url ?

because I'm trying to work with sqlobject, and I have to tell my self that I'm far away of a good comprehension of it.. : (

Sometimes, I do think that it will help a lot, to have such compilations. So that people can scan it, test them very easily. Such snippet shall have some use of them (case that work, case that do not work) some explanation in which can we can use them and so on.

For example, what I've learned recently.

class test(object):
   def __init__(self):
   def setname(self,name, value):
   def dico(self):
      return printDico

testInstance=test()            # *
setname=testInstance.setname   # **
dico=testInstance.dico         # ***

in the python interpreter.
import module
del module
# so I've supposed that the garbage collector will destruct this.
from module import dico
# tintintammm and badaboum there are still there

So I imagine, that when you import this module. ``testInstance'' is created
in the object space, but it is not assigned to the namespace. So the only way to
destruct such module, will be within the module.

I found that such module act has a singleton


Geneva - Switzerland

More information about the Tutor mailing list