Re: Is there a nicer way to do this?

2007-10-04 Thread Amaury Forgeot d'Arc
butes): attributeNames["AttributeName.%d" % (n+1)] = attribute Then use a generator expression to feed the dict: attributes = ['foo', 'bar'] attributeNames = dict(("AttributeName.%d" % (n+1), attribute) for n, attribute in enumerate(attributes)) Hope this helps, -- Amaury -- http://mail.python.org/mailman/listinfo/python-list

Re: Lost in __setstate__() in C++ and swig

2007-09-13 Thread Amaury Forgeot d'Arc
File "/usr/src/sound.d/pyramid/pyramid.py", line 618, in len > return _pyramid.MidiBytes_len(*args) > TypeError: in method 'MidiBytes_len', argument 1 of > type 'pyramid::MidiBytes *' This message is typical of a swig object whos

Re: c macros in python.

2007-05-06 Thread Amaury Forgeot d'Arc
ro facility. But in this particular case, it is very simple. Just add: o = outfile.write after the variable outfile is initialized. It is not a macro (just another name for a function object) but it looks the same... -- Amaury -- http://mail.python.org/mailman/listinfo/python-list

Re: howto make Python list from numpy.array?

2007-05-06 Thread Amaury Forgeot d'Arc
Hello, John Nagle a écrit : > dmitrey wrote: >> howto make Python list from numpy.array? >> Thx, D. >> > > lst = map(None, arr)// for 1D arrays. Which can be expressed more simply as: lst = list(arr) -- Amaury -- http://mail.python.org/mailman/listinfo/python-list

Re: wx and SOAPpy interaction

2007-04-14 Thread Amaury Forgeot d'Arc
python-list/2006-April/377070.html The problem is that wxWidgets embeds its own copy of expat. You may have to recompile either python or wxWidgets so that they use the same expat version. -- Amaury Forgeot d'Arc -- http://mail.python.org/mailman/listinfo/python-list

Re: help building debug .pyd files

2007-04-11 Thread Amaury Forgeot d'Arc
should read the file PCBuild/readme.txt. It explains how to build python from source, and has long explanations about the same list of modules you are asking for. And it works: I regularly use the debug build of python for my own projects. -- Amaury Forgeot d'Arc -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting started with Crystal Reports...little help in the far court.

2007-01-08 Thread Amaury Forgeot d'Arc
an instance of the previous class. Voilà, it's not much. In the hope that you can do something with it. But don't give up. At the end, it works... -- Amaury -- http://mail.python.org/mailman/listinfo/python-list

Re: I'm having trouble understanding scope of a variable in a subclass

2006-12-28 Thread Amaury Forgeot d'Arc
iffers with your second example because the parentheses are missing after the name "Class3". - Your second example does not work as you say. 'var' is a local variable and cannot be accessed from the outside. I suppose you actually entered something like: self.var="var" which works indeed. Again, it is difficult to guess what you are trying to do. -- Amaury -- http://mail.python.org/mailman/listinfo/python-list

Re: for: else: - any practical uses for the else clause?

2006-09-26 Thread Amaury Forgeot d'Arc
: print "no matching item" return False # ... continue with value -- Amaury -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython: StaticText Event

2006-09-07 Thread Amaury Forgeot d'Arc
d the following thread: http://lists.wxwidgets.org/archive/wx-users/msg31855.html or http://lists.wxwidgets.org/archive/wx-users/msg31983.html It suggest that you use another kind of control instead. Is a disabled TextCtrl acceptable? Hope this helps, -- Amaury -- http://mail.python.org/m

Re: py2exe and libxml

2006-09-04 Thread Amaury Forgeot d'Arc
exe-users/3180430 It seems a regression since py2exe 0.6.5, already corrected in CVS trunk. And according to another post, version 0.6.3 works fine: http://permalink.gmane.org/gmane.comp.python.py2exe/1502 Hope this helps, -- Amaury -- http://mail.python.org/mailman/listinfo/python-list

Re: psyco+webpy

2006-06-26 Thread Amaury Forgeot d'Arc
w the class name. It does not appear in the error traceback) Depending on your architecture, this may be written this way: import codepsyco psyco.cannotcompile(codepsyco.YourClassHere.GET) -- Amaury -- http://mail.python.org/mailman/listinfo/python-list

Re: psyco+webpy

2006-06-26 Thread Amaury Forgeot d'Arc
rkaround, you should prevent psyco from optimizing the functions calling render(). psyco.cannotcompile(web.djangoerror) psyco.cannotcompile(??.GET) P.S. I just had a look at the web.py code and it seems that there are several uses of _getframe(x).f_locals. I find this trick not very pythonic (a function's docstring even says:"""Guido van Rossum doesn't want you to use this function.""") and anyway psyco will not appreciate it. -- Amaury -- http://mail.python.org/mailman/listinfo/python-list

Re: Psyco performance

2006-06-20 Thread Amaury Forgeot d'Arc
o emit code specialized for the actual data. It works by replacing blocks of code by other blocks, optimized for the kind of data seen the previous times. On the contrary, the code outside functions is run only once. You'll never get the chance to run the optimized version again... --

Re: Is there a built-in method for transforming (1,None,"Hello!") to 1,None,"Hello!"?

2005-11-13 Thread Amaury
iable, and want to call a function with the tree arguments: args = (1,None,"Hello!") func(args) # equivalent to func((1,None,"Hello!")) func(*args) # equivalent to func(1,None,"Hello!") Note the '*' on the second call, it will flatten the args,

Re: How do I sort these?

2005-10-28 Thread Amaury
3, 4], ['a', 'b', 'c', 'd', 'e']] > unzip() could be also be written like this: def unzip(seq): return zip(*seq) Faster and nicer, isn't it? Except that it returns a list of tuples: >>>unzip(zip(range(5), 'abcde')) [(0, 1, 2, 3, 4), ('a', 'b', 'c', 'd', 'e')] -- Amaury -- http://mail.python.org/mailman/listinfo/python-list

Re: Overriding methods in classes you don't control

2005-03-29 Thread Amaury Forgeot d'Arc
init__ directly calls the C++ constructor, completely ignoring wxFrame.__init__. The call to the superclass' constructor is done in C++. Since replacing C++ method is much more difficult (if possible at all), I'm afraid you will have to do the replacement you plan for every derived class. Ama

Re: Overriding methods in classes you don't control

2005-03-29 Thread Amaury Forgeot d'Arc
it__ directly calls the C++ constructor, completely ignoring wxFrame.__init__. The call to the superclass' constructor is done in C++. Since replacing C++ method is much more difficult (if possible at all), I'm afraid you will have to do the replacement you plan for every derived class. Amaury. -- http