What is an instance and what isn't?

2007-05-24 Thread Gre7g Luterman
I suppose I was lulled into complacency by how Python makes so many things look like classes, but I'm starting to realize that they're not, are they? I'm writing a C program which handles Python objects in different ways based on their type. I do a PyInstance_Check(PyObj) to determine if the PyO

Re: _PyObject_New / PyObject_Init / PyInstance_New / etc?

2007-05-20 Thread Gre7g Luterman
> From Python, you create a Noddy object by *calling* its type. Do the same > in C: > > return PyObject_CallObject((PyObject *) &NoddyType, NULL); > > Or any other suitable variant of PyObject_CallXXX. (I've answered this > same question yesterday, when I was not sure about this; then I've tried

Re: Many-to-many pattern possiable?

2007-05-19 Thread Gre7g Luterman
"Jia Lu" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I see dict type can do 1-to-1 pattern, But is there any method to do > 1-to-many, many-to-1 and many-to-many pattern ? Dict objects can do many-to-1 relationships. Dict[Key1] = Obj Dict[Key2] = Obj Dict[Key3] = Obj 1-to-man

Re: Creating a sub folder in the pythons LIB Directory

2007-05-19 Thread Gre7g Luterman
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I am creating a library of functions. I would like to have them saved > in a sub folder of pythons LIB folder, but I cannot get it to work. > > I have a script called test.py > I stored it in LIB folder and typed > Import test,

_PyObject_New / PyObject_Init / PyInstance_New / etc?

2007-05-19 Thread Gre7g Luterman
(My apologies if this appears twice. It did not post the first time.) I'm so confuzzled! How do I instantiate my new C Python object from C? After flailing helplessly with my own code, and searching tirelessly with Google, I stepped back to the classic noddy2.c example in the Python help files an

Re: Writelines() a bit confusing

2007-05-19 Thread Gre7g Luterman
"aiwarrior" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If file.WriteLines( seq ) accepts a list and it says it writes lines, > why does it write the whole list in a single line. Be cause of that > the reverse of file.writelines(seq) is not file.readlines(). > Are the assumptions