Re: HELP!...Google SketchUp needs a Python API

2008-12-01 Thread cptnwillard
Don't feed the troll. -- http://mail.python.org/mailman/listinfo/python-list

Re: SWIG vs. ctypes (Was: ANN: PyEnchant 1.5.0)

2008-11-25 Thread cptnwillard
On Nov 25, 4:34 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > You can't use ctypes for C++, only for C-style APIs. > > Diez With some work, you can convert your C++ objects to PyObject* and then return the latter in a function with C bindings. -- http://mail.python.org/mailman/listinfo/pyt

Re: end of print = lower productivity ?

2008-11-25 Thread cptnwillard
On Nov 25, 5:05 pm, peter <[EMAIL PROTECTED]> wrote: > BUT you now can do > > >>> p = print > >>> p("f") > > Voila, 4 keystrokes saved :-) All right. Let's talk about that. When I write "print", it is both effortless and instantaneous : my hands do not move, a wave goes through my fingers, it all

Re: end of print = lower productivity ?

2008-11-25 Thread cptnwillard
On Nov 25, 4:53 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > I used to use print a lot. Once I found > > import pdb; pdb.set_trace() > > I massively lost interest in it. And gained *much* more debugging > power/productivity. In some cases, this is not discriminatory enough : there are simpl

end of print = lower productivity ?

2008-11-25 Thread cptnwillard
I want my productivity back. In Python 2.x, I could easily write things like -- print "f" / print "add" / print "done" -- to a lot of different places in my code, which allowed me to find bugs that I could not track otherwise. When I found out that "f" was not at fault, I could write -- print "g"

Re: Is this a bug, or is it me?

2008-01-18 Thread cptnwillard
I filed a bug report, and here is the short answer to my question: genexps are code blocks, and code blocks cannot see variables in class scopes. Congrats to Neil Cerutti who figured it out. Now here is another one for your enjoyment: class C: @staticmethod def f1(): pass

Re: Is this a bug, or is it me?

2008-01-17 Thread cptnwillard
> > You cannot access a class's class variables in it's class-statement > scope, since the name of the type is not bound until after the class > statement is completed. > Thanks for the answer, but then why is there no error with the variable 'TYPES'? This one is accessed first... -- http://mail.

Re: Is this a bug, or is it me?

2008-01-17 Thread cptnwillard
On Jan 17, 4:14 pm, [EMAIL PROTECTED] wrote: > > Do not use those names...really poor choice... This is not the way it looks it my code. I simplified it, with generic names, in order to point out something that does not work... The only question here is why? -- http://mail.python.org/mailman/list

Is this a bug, or is it me?

2008-01-17 Thread cptnwillard
Hello all, For some reason, the following does not work : class C: TYPES = [None] DICT = {} for Type in TYPES: DICT.update((E,Type) for E in [1]) >>> NameError: global name 'Type' is not defined What do you think? Is this a bug? -- http://mail.python.org/mailman/listinfo/p

Re: Python Class Best Practice

2007-12-05 Thread cptnwillard
On Dec 5, 12:18 am, Rod Person <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > I've been doing python programming for about 2 years as a hobby and now > I'm finally able to use it at work in an enterprise environment. Since > I will be creating the base classes and

Re: Is there any way to catch expections when call python method in C++

2007-06-13 Thread cptnwillard
One way is to create an intermediate python function, which returns a special value when an exception is caught. def ExceptionCatcher(FunctionToCall): def F(): try: FunctionToCall() except: return -1 return 0 return F Then instead of calling your function, you woul

Re: list comprehension help

2007-03-18 Thread cptnwillard
I wonder whether the following be more efficient if DB was a dictionnary: Splits = (line.split(' ') for line in open('file.text', 'r')) DB = dict([(S[0], S[-1]) for S in Splits]) -- http://mail.python.org/mailman/listinfo/python-list

Re: C++ and Python

2007-03-09 Thread cptnwillard
On Mar 9, 7:04 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi Everyone, > > I'm considering about generating some Python Bindings for C++ > libraries. What are considered the best tools for doing something like > this? I know that there are SWIG, SIP, Boost.Python, and GCC_XML. > > Thanks!

Re: Python GUI + OpenGL

2007-03-05 Thread cptnwillard
You don't necessarily need an OpenGL wrapper like PyOpenGL. If you only use a handful of OpenGL functions, it would be relatively straight-forward to make your own, using ctypes. Here is what it would look like: from ctypes import cdll, windll, c_double, c_float, c_int GL_POINTS = 0x

Re: wxpython worked out but can't find api docs for download.

2006-12-03 Thread cptnwillard
Sorry, I think all you want is "wxPython-newdocs", which is the wxPython-specific documentation. -- http://mail.python.org/mailman/listinfo/python-list

Re: wxpython worked out but can't find api docs for download.

2006-12-03 Thread cptnwillard
Go to: http://wxpython.org/download.php#binaries and in the documentation part, download both "wxPython-docs" and "wxPython-newdocs". Hope this helps. -- http://mail.python.org/mailman/listinfo/python-list

access violation with C API

2006-09-11 Thread cptnwillard
Hello all, The following triggers an "access violation" error, why? pPyType = (PyTypeObject*)malloc(sizeof(PyTypeObject)); memset(pPyType, 0, sizeof(PyTypeObject)); pPyType->ob_refcnt= 1; pPyType->tp_name = "noname";