[noob question] References and copying

2006-06-09 Thread zefciu
], [3, 4]] >>> b [5, 6] And I don't understand it. I thought, that b will be a reference to a, so changing b should change a as well. What do I do wrong. And a second question - can I create a reference to element of a list of floating points and use this reference to change t

Reuseable iterators - which is better?

2006-06-23 Thread zefciu
In the tutorial there is an example iterator class that revesrses the string given to the constructor. The problem is that this class works only once, unlike built-in types like string. How to modify it that it could work several times? I have tried two approaches. They both work, but which of

Re: How to run Python file?

2006-09-02 Thread zefciu
hats if you use un*x. If you word under windows, the first would work, but rather use some IDE like IDLE or SPE than mess with the windows command line. Then you just load the file and run it from the menu. zefciu -- http://mail.python.org/mailman/listinfo/python-list

Inheritance doesn't work

2006-12-04 Thread zefciu
? File "mandelimage.py", line 3, in ? class MandelImage (Image): TypeError: Error when calling the metaclass bases module.__init__() takes at most 2 arguments (3 given) I am using python 2.4 from the Debian (Sid) packages. Is it a bug, or am I doing something wrong? zefciu -- -BEGI

Re: Converting a c array to python list

2007-03-02 Thread zefciu
earth can I create array object in C? zefciu -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a c array to python list

2007-03-03 Thread zefciu
uld put the whole loop into c code. But as before the function returned only one integer at every call, now it would have to return a rather large array of integers (maybe chars would be enough). zefciu -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a c array to python list

2007-03-04 Thread zefciu
Dennis Lee Bieber wrote: > Written properly, all it returns is the address of that array data > -- there is no massive copying of data.. I know :) That's why I want to know how to write it properly. zefciu -- http://mail.python.org/mailman/listinfo/python-list

Curious behaviour of Tkinter object

2007-03-10 Thread zefciu
x27;t understand why it happens like this. zefciu import Tkinter from mandelpalette import MandelPalette class MandelSetWindow(Tkinter.Toplevel, object): """A dialog window with main fractal settings""" def __init__(self, settings, callback):

Re: Hacking in python

2007-02-10 Thread zefciu
s Open Source. If you mean hacking as cracking into computer systems, then what's the difference if it's with Python or anything else. If you mean hacking as gaining excellency in programming - then why should it be? Greets zefciu -- http://mail.python.org/mailman/listinfo/python-list

Re: builtin set literal

2007-02-20 Thread zefciu
-} make it C-ish and Perlish. Frop Python-zen: Simple is better than complex. Flat is better than nested. Sets are good. Sets are fun. Sets are pythonish (the programmer codes the logical side of a data structure, bothering less 'bout the technical). I think, they deserve their literal n

SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread zefciu
{ NULL, NULL, 0, NULL } }; PyMODINIT_FUNC initmandelc(void) { (void) Py_InitModule ("mandelc", MandelcMethods); } int main(int argc, char **argv) { Py_SetProgramName(argv[0]); Py_Initialize(); initmandelc(); return 0; } Greets zefciu -- http://mail.python.org/mailman/listinfo/python-list

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread zefciu
Thinker wrote: > zefciu wrote: >>> I am trying to embed a c function in my python script for a first >>> time. When I try to call it I get an error >>> >>> SystemError: new style getargs format but argument is not a tuple >>> >>> Guido sa

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread zefciu
Thinker wrote: > It should be "PyObject *coord;" . > Maybe, it is what is wrong with your program! > > Should it? The gcc shows me a warning then: warning: 'coord' is used uninitialized in this function and during the execution I get the same error *pl

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread zefciu
isn't. But can PyArg_ParseTuple be used to tuples other than function arguments? If not, what should I use? zefciu -- http://mail.python.org/mailman/listinfo/python-list

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread zefciu
, 1.5), 9, 2.2) args parsed coord parsed ii3 >>> mandelpixel((1.5, 1.5), 9, 2.2) TypeError: bad argument type for built-in operation etcaetera (the "args parsed" "coord parsed" and "i" are effect of printfs in the code, as you see when it fails, it doesn&

Re: SystemError: new style getargs format but argument is not a tuple

2007-02-26 Thread zefciu
orks, but I will of course change it to get the simpler parenthesised version as in your Example 1. Great thanks :D zefciu -- http://mail.python.org/mailman/listinfo/python-list

Re: Add images together

2007-02-26 Thread zefciu
hat in fact you are trying to do. Please provide us with further info - what are you working at? zefciu -- http://mail.python.org/mailman/listinfo/python-list

Re: os.system and quoted strings

2007-02-27 Thread zefciu
eName are variables, not literal parts of the string. You should put those names outside the quotation marks, or better us the % format operator as Sriram showed you, or even better use os.path module. Here is the reference: http://docs.python.org/lib/module-os.path.html zefciu -- http://mail.python.org/mailman/listinfo/python-list

Converting a c array to python list

2007-03-01 Thread zefciu
performance to the process? zefciu -- http://mail.python.org/mailman/listinfo/python-list