problems importing from /usr/lib/pyshared/

2013-01-10 Thread Harold
Dear all, I recently upgraded my system from ubuntu 11.4 to 12.4 and since run into an issue when trying to import several packages in python2.7, e.g. harold@ubuntu:~$ python -c 'import gtk' Traceback (most recent call last): File "", line 1, in File "/usr/lib/py

Re: problems importing from /usr/lib/pyshared/

2013-01-12 Thread Harold
Thank you Dieter, > Ubuntu 12 has introduced important changes with respect to "glib" (and > depending packages). In fact, there are now two quite incompatible > implementations - the old "static" one and a new "dynamic" one. > It looks as if in your case, old and new implementations were mixed. >

Significant figures calculation

2011-06-24 Thread Harold
Hi, I am looking for an easy way to do significant figure calculations in python (which I want to use with a class that does unit calculations). Significant figure calculations should have the semantics explained, e.g., here: http://chemistry.about.com/od/mathsciencefundamentals/a/sigfigures.htm

Re: Significant figures calculation

2011-06-24 Thread Harold
> > I tried to modify the DecimalContext (e.g. getcontext().prec = 2) but > > that did not lead to the correct behavior. > > Really? It works for me. You are right, I did something wrong when attempting to set the precision. And the trick with rounding the decimal with the unary + is neat. It's th

Re: Significant figures calculation

2011-06-26 Thread Harold
> >I'm curious.  Is there a way to get the number of significant digits > >for a particular Decimal instance? > > Yes: > > def sigdig(x): >     "return the number of significant digits in x" >     return len(x.as_tuple()[1]) Great! that's exactly what I needed. thanks Chris! -- http://mail.python

Re: Significant figures calculation

2011-06-27 Thread Harold
On Jun 25, 9:04 pm, Chris Torek wrote: > >I'm curious.  Is there a way to get the number of significant digits > >for a particular Decimal instance? > > Yes: > > def sigdig(x): >     "return the number of significant digits in x" >     return len(x.as_tuple()[1]) Great, Chris, this is (almost) ex

problems when unpacking tuple ...

2006-04-22 Thread harold
s to unpack What is going wrong here? Why does python think that I want to unpack the outcome of line.split() into three values instead of four? I must be really tired, but I just cannot see the problem. Any clues?? Thanks, - harold - -- http://mail.python.org/mailman/listinfo/python-list

Re: problems when unpacking tuple ...

2006-04-22 Thread harold
Rene Pijlman schrieb: > harold: > >The output (when given the data I want to parse) is: > > If you'd told us that data, and told us what version of Python you're > using, we could have reproduced the problem to look into it. > Thank you for the answers and so

Re: problems when unpacking tuple ...

2006-04-22 Thread harold
Thank you Gerard. This must be the problem. Now I can get it working. -- http://mail.python.org/mailman/listinfo/python-list

Re: problems when unpacking tuple ...

2006-04-22 Thread harold
Thanks for all your answer! Of course, I wanted to assign the outcome of the split(), not to iterate over them. Thinks are done so easy in python that, sometimes, one does not even notice that one actually does them ;-) Cheers, - harold - -- http://mail.python.org/mailman/listinfo/python-list

Re: check whether a value is scalar

2006-04-22 Thread harold
would isinstance(value,(type(None),str,int,float,bool)) be enough? This yields true if the type value is in the list of type objects given as second argument, or a subtype of one of them. What, however, do you mean with "I care about the value only, and not its class method"? -- http://mail

Re: Subclass str: where is the problem?

2006-04-24 Thread harold
[EMAIL PROTECTED] schrieb: > Hello, can anybody explain/help me: > > Python 2.4.2 (#2, Sep 30 2005, 21:19:01) > [GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2 > > > class Upper(str): > def __new__(cls, value): > return str.__new__(cls, value.upper()) > > u = Upper('test

Re: Subclass str: where is the problem?

2006-04-24 Thread harold
value again. Be carefull with the condition/and/or chain! You must be 110% sure, that the desired return value in case of condition==True can never evaluate to False! - harold - -- http://mail.python.org/mailman/listinfo/python-list

Re: how to free the big list memory

2006-04-27 Thread harold
pydoc gc.collect pydoc xrange -- http://mail.python.org/mailman/listinfo/python-list

Re: how do I make a class global?

2006-04-27 Thread harold
basically, you can create new types on the fly using type() with three arguments: my_class = type("className",(BaseClass,),class_dict) then, you can assign this vlass to the golbal namespace using globals(): globals()["className"] = my_class In your case, you would need to populate the class_di

Re: Microsoft Hatred FAQ

2005-10-25 Thread Harold Stevens
s a legitimate business strategy." Well, duh. All they got was a useless wrist-slap from the dickless US DOJ in 2002, so this is not at all surprising--just bidness as usual for M$. More: http://biz.yahoo.com/ap/051020/microsoft_antitrust.html?.v=6 And any M$ apologists are just as mu

Re: Microsoft Hatred FAQ

2005-10-27 Thread Harold Stevens
Any M$ apologists saying M$ isn't an illegal monopoly are just as much a part of that pack of liars and thieves as M$ itself. They need to discuss it with Judge Colleen, and STignorantFU about it. -- Regards, Weird (Harold Stevens) * IMPORTANT EMAIL INFO FOLLOWS * Pardon any bogus email ad

Re: cosmetic Tkinter question

2005-01-03 Thread harold fellermann
looks a little gross. How do I get them to align? if you pack the frames with option fill=X they should be well aligned -- This commands the frame to use all available space in the horizontal direction: your_frame.pack(side=TOP,fill=X) your_button.pack(side=LEFT) - harold - -- What is mind? -- Doesn

syntax error in eval()

2005-01-10 Thread harold fellermann
> eval("X.%s = val" % attrname , {"X":X, "val":5}) Traceback (most recent call last): File "", line 1, in ? File "", line 1 X.attr = val ^ SyntaxError: invalid syntax Does anyone have a clue what might be wrong? Thanks in ad

Re: syntax error in eval()

2005-01-10 Thread harold fellermann
Thank you, Duncan and Steven. I completely forgot about setattr. Of course that's the way ... as its name might suggest *g* What you are doing wrong is attempting to use eval before exhausting all the simpler techniques. Why not just call 'setattr'? setattr(X, 'attr', 5) BTW, the syntax error is

Re: here document

2005-01-11 Thread harold fellermann
On 11.01.2005, at 11:34, Nader Emami wrote: Would somebody help me how i can write the 'here document' in Python script please? I have a csh script in which a program is invoked with some argument in the form of here document: /bin/exe.x << End_Here CategorY = GRIB etc. End_Here I translate this

how to set doc-string of new-style classes

2005-01-11 Thread harold fellermann
can understand someone arguing that "changing a doc string is during programm execution and should therefore be forbidden!" But, I cannot even find out a way to set the doc string, when I CREATE a class using type(name,bases,dict) ... At least this should be possible, IMHO. - harold - -- If

Re: exporting from Tkinter Canvas object in PNG

2005-01-11 Thread harold fellermann
u can make a postscript dump using >>> canvas = Tkinter.Canvas(master) >>> canvas.postscript(file="your_file_name.ps") If you have ImageMagick, you can later use % convert your_file_name.ps your_file_name.png on the comand line, if you want to have png. - harold - -- Science

Re: how to set doc-string of new-style classes

2005-01-12 Thread harold fellermann
On 11.01.2005, at 19:35, Alex Martelli wrote: harold fellermann <[EMAIL PROTECTED]> wrote: ... But, I cannot even find out a way to set the doc string, when I CREATE a class using type(name,bases,dict) ... At least this should be possible, IMHO. x=type('x',(),dict(__doc_

Re: Why would I get a TypeEror?

2005-01-12 Thread harold fellermann
builtin__: len(...) len(object) -> integer Return the number of items of a sequence or mapping. - harold - -- Ceci n'est pas une signature. -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Why would I get a TypeEror?

2005-01-12 Thread harold fellermann
. You have to do it this way instead: a=3 ... b = isinstance(a,(list,tuple,dict)) and len(a) or 1 - harold - -- The opposite of a correct statement is a false statement. But the opposite of a profound truth may be another profound truth. -- Niels Bohr -- http://mail.python.org/mailman/listinfo/p

Re: Unclear On Class Variables

2005-01-13 Thread harold fellermann
# does the same this might be sometimes confusing. IMHO, the following is especially nasty: >>> foo = Foo() >>> foo.x += 1 >>> >>> print foo.x 1 >>> print Foo.x 0 although the += operator looks like an inplace add it isn't. it is just sy

Re: Pickling a class instead of an instance

2005-01-13 Thread harold fellermann
have a look at the thread "copying classes?" some days ago. what goes for copying goes for pickling also, because the modules use the same interface. - harold - On 13.01.2005, at 13:32, Sebastien Boisgerault wrote: Hi, It seems to me that it's not possible with the pickle module

Re: Using Tix and Tkinter

2005-01-13 Thread harold fellermann
quot;TixTest.py", line 8, in ? Tix.tixControl().pack() AttributeError: 'module' object has no attribute 'tixControl' in the Tix module this widget is called Control. writing Tix.Control().pack() should work. - harold - -- Man will occasionally stumble over the truth, but most

Tix.FileSelectDialog wait for user?

2005-01-13 Thread harold fellermann
her information, like common usage or examples, that might normally be expected in a manual cannot be found with no additional arguments. The Tk manual returns the completely clueless programmer. Start to like pydoc(Tkinter) and pydoc(Tix), though :-) - harold - -- "Mr Ghandi, what do you t

pickling extension class

2005-01-18 Thread harold fellermann
PicklingError( pickle.PicklingError: Can't pickle : it's not found as hyper.PeriodicGrid >>> dir(hyper) ['Dir', 'Neighbors', 'PeriodicGrid', 'PeriodicPos', '__doc__', '__file__', '__name__', 'refcoun

Re: pickling extension class

2005-01-18 Thread harold fellermann
On 18.01.2005, at 20:31, Alex Martelli wrote: harold fellermann <[EMAIL PROTECTED]> wrote: File "/sw/lib/python2.4/pickle.py", line 760, in save_global raise PicklingError( pickle.PicklingError: Can't pickle : it's not found as hyper.PeriodicGrid dir

Re: Class introspection and dynamically determining functionarguments

2005-01-24 Thread harold fellermann
ets, so no instance creation in this part). As this was only a short snippet in the project I am doing, I could, never give it the time it deserved. So I am sure that my code is not the best sollution, but maybe it serves as a starting point for further discussion. All the best, - harold

Re: eval() in python

2005-06-21 Thread harold fellermann
ot;, "credits" or "license" for more information. >>> s="print 'hello Xah Lee :-)'" >>> exec(s) hello Xah Lee :-) >>> - harold - -- I wish there was a knob on the TV to turn up the intelligence. There's a knob called &quo

Re: Python internals and parser

2005-06-23 Thread harold fellermann
Hi, On 22.06.2005, at 23:18, Michael Barkholt wrote: > Is there any detailed documentation on the structure of Pythons > internals, > besides the source code itself? > > More specifically I am looking for information regarding the C parser, > since > I am looking into the viability of using it i

Re: I need help figuring out how to fix this code.

2005-06-28 Thread harold fellermann
ot;]: > print "May I have your autograph please!" > else > print name,", that's a nice name!" name = raw_input("What is your name, plase? ") if name == "Nathan" : print "What a great name!" elif name

trace function calls to get signatures

2005-07-04 Thread harold fellermann
m.pulldom.PullDOM.clear However, I cannot find a way from the frame object to the function object where I could find the information. 2. The KeyError in my code is raised by the "from XXX import" statement: "from distutils import setup" results in File &q

Re: Conditionally implementing __iter__ in new style classes

2005-07-06 Thread harold fellermann
eve it, but why don't you simply use class Base: pass class Concrete(Base): def __iter__(self) : yield 1 yield 2 yield 3 What is the advantage to have a baseclass that essentially does some method renaming __iter__ ==> Iterator?

Re: inheriting file object

2005-07-06 Thread harold fellermann
be invoked automatically. class myFile(file) : def __init__(self,fname,mode="r") : file.__init__(self,fname,mode) for line in myFile('testfile') : print line - harold - -- If your only tool is a hammer, every problem looks like a nail. -- -- http://mail.python.org/mailman/listinfo/python-list

Re: inheriting file object

2005-07-06 Thread harold fellermann
If you would tell as your use case, it would be easier to give you an advice. - harold - -- Yesterday is but today's memory and Tomorrow is today's dream. -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows Cmd.exe Window

2005-07-07 Thread harold fellermann
it.register(raw_input) works fine in my terminal. should do in your framework also. cheers, - harold - -- What is mind? -- Doesn't matter. What is matter? -- Never mind! -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows Cmd.exe Window

2005-07-07 Thread harold fellermann
On 07.07.2005, at 15:43, harold fellermann wrote: > On 07.07.2005, at 15:25, Giles Brown wrote: > >> Nah. You're missing my point. I only want the command window not to >> be closed if there is an *exception*. Picky I know, but there you go. > > well, then regist

Re: Missing Something Simple

2005-07-12 Thread harold fellermann
his example the former list values are not used anyway, you could just write: varList = [ returnVarFromFunction for i varList ] cheers, - harold - -- Tages Arbeit, abends Gäste, saure Wochen, frohe Feste! -- Johann Wolfgang v. Goethe -- http://mail.python.org/mailman/listinfo/python-list

Re: Missing Something Simple

2005-07-12 Thread harold fellermann
n varList : i.set(returnVarFromFunction()) print a,b,c prints whatever returnVarFromFunction has returned. n.b.: instead of the Proxy class, you can use any other mutable objects, e.g. lists. - harold - -- "All unsere Erfindungen sind nichts als verbesserte Mittel zu einem nicht verbesserten Zweck." -- H.D. Thoreau -- http://mail.python.org/mailman/listinfo/python-list

Re: automatic form filling

2005-07-12 Thread harold fellermann
de form_data = { 'byDay' : '12' , 'byMonth' : '07' , 'byYear' : '2005' } html_data = urlopen( "http://www.los40.com/actualidad/listas/busquedas_b.html";, urlencode(form_data) ).read() print html_da

Re: How can I import a py script by its absolute path name?

2005-07-14 Thread harold fellermann
rt a module whose name is given as a string. - harold - -- Tages Arbeit, abends Gäste, saure Wochen, frohe Feste! -- Johann Wolfgang v. Goethe -- http://mail.python.org/mailman/listinfo/python-list

How to extend inner classes?

2004-12-21 Thread harold fellermann
Thank you very much. Of course I know how to do it in python. The problem is that I want to reimplement these classes as a python extension in C. The question is: how can I add class members (like e.g. inner classes) to a PyTypeObject defined in a C extension? - harold - > You can defin

Re: Keyword arguments - strange behaviour?

2004-12-21 Thread harold fellermann
Hi, I cannot see any strange behavior. this code works exacly as you and I suspect: >>> def otherfunction(x) : ... return x ... >>> def function(arg=otherfunction(5)) : ... return arg ... >>> function(3) 3 >>> function() 5 Or is this not what you excep

copying classes?

2004-12-29 Thread harold fellermann
ss? What is special about the objects of these types that they cannot be easily copied? Any help appreciated, - harold - -- I like pigs. Dogs look up to us. Cats look down to us. Pigs treat us as equal. -- Winston Churchill -- http://mail.python.org/mailman/listinfo/python-list

Re: copying classes?

2004-12-31 Thread harold fellermann
the object itself. I always think that a well designed object should have a copyme method. :=) take a look at the __setstate__ and __getstate__ documentation of copy (e.g. pickle) -- with them you can customize the copying task. Anyway, they work only on instance but not on class objects :

Re: property and virtuality

2005-04-01 Thread harold fellermann
the following lines of Python : class Foo : class Bar : pass spam = "foobar" How can this class be translated to a C extension? Is there anything comparable to PyMethodDef that can be used for other attributes than functions? Thanks for your help

class attributes and inner classes in C extensions

2005-04-01 Thread harold fellermann
following lines of Python : class Foo : class Bar : pass spam = "foobar" How can this class be translated to a C extension? Is there anything comparable to PyMethodDef that can be used for other attributes than functions? Thanks for your help, - harold -

Re: class attributes and inner classes in C extensions

2005-04-01 Thread harold fellermann
ct *)&FooType); Py_INCREF(&hyper_FooBarType); PyModule_AddObject(m, "Bar", (PyObject *)&FooBarType); } Documentation for tp_dict can be found in the API: http://docs.python.org/api/type-structs.html - harold - -- "2x2 = grün" -- Heinz von Foerster -- http://mail.python.org/mailman/listinfo/python-list

Re: class attributes and inner classes in C extensions

2005-04-01 Thread harold fellermann
ks for the proposal. - harold - -- I wish there was a knob on the TV to turn up the intelligence. There's a knob called "brightness", but it doesn't seem to work. -- Gallagher -- http://mail.python.org/mailman/listinfo/python-list

Re: Class, object question.

2005-04-06 Thread harold fellermann
of course, class is written lower case. Cheers, - harold - -- Es ist schon längst alles gesagt worden -- aber noch nicht von jedem. -- Karl Valentin -- http://mail.python.org/mailman/listinfo/python-list

richcmpfunc semantics

2005-04-06 Thread harold fellermann
good documentation available, but I cannot find it. So, any references or help is appreciated. Cheers, - harold - -- "Scientist are very good in answering the questions they choose to answer." -- Richard Alley -- http://mail.python.org/mailman/listinfo/python-list

Re: richcmpfunc semantics

2005-04-07 Thread harold fellermann
eturn NULL; instead. What is the difference between the two and which one is to prefer. Also, do you need to increment the reference count of Py_NotImeplemented before returning it? Thanks, - harold - -- I like pigs. Dogs look up to us. Cats look down to us. Pigs treat us as equal. -- Winston Churchi

Re: Equivalent string.find method for a list of strings

2005-04-08 Thread harold fellermann
#x27;my particular string') : do_something() of just read in the whole file, if you are not interested in the particular line, where 'my particular string occurs': myfile.read().find('my particular string') Cheers, - harold - -- "All unsere Erfindungen sind nichts al

curses for different terminals

2005-04-14 Thread harold fellermann
). However, this function seems not to be defined in the python library. Does anyone know how this can be done in python? cheers, - harold - -- Life is what happens while you're busy making other plans -- John Lennon -- http://mail.python.org/mailman/listinfo/python-list

Re: curses for different terminals

2005-04-14 Thread harold fellermann
On 14.04.2005, at 19:17, Christos TZOTZIOY Georgiou wrote: On Thu, 14 Apr 2005 18:39:14 +0200, rumours say that harold fellermann <[EMAIL PROTECTED]> might have written: Hi all, I want to use curses in a server application that provides a GUI for telnet clients. Therefore, I ne

ScientificPython - LeastSquareFit diverges

2006-07-18 Thread Harold Fellermann
ld easily fit the above data using gnuplots internal fitting procedure. Any idea what is going wrong here? Is it a known problem? Are there any work arounds or other packages? Any help is appreciated! - harold - -- http://mail.python.org/mailman/listinfo/python-list

Re: tkinter help

2006-07-18 Thread Harold Fellermann
that option to do > advance search. If I understood you correctly, this is how I would go for it: consider to create all submenus during initialization but make them invisible (put each of them in a single frame) anf toggle the visibility of these frames in the handler of your option

Re: ScientificPython - LeastSquareFit diverges

2006-07-19 Thread Harold Fellermann
/levmar/). Are there any plans to improve the SciPy algorithm? Would it be a welcome contribution to SciPy to work this part out? - harold - -- http://mail.python.org/mailman/listinfo/python-list

Re: A suggestion/request for IDEs

2006-10-19 Thread Harold Trammel
John Salerno wrote: > I apologize for the slightly off-topic nature, but I thought I'd just > throw this out there for anyone working on text editors or IDEs with > auto-completion. > > I think it should be a feature, when an item is selected for > auto-completion in a drop-down box, that press

how to switch from os.tmpnam to os.tmpfile

2006-06-08 Thread Harold Fellermann
r, but I do not know how to get the path information from the file object returned by tmpfile(). any clues? thanks! - harold - -- http://mail.python.org/mailman/listinfo/python-list

Re: From Python to Shell

2006-06-08 Thread Harold Fellermann
its stdout and stderr streams. have a look at the docs of that module for more information. - harold - -- http://mail.python.org/mailman/listinfo/python-list

Re: how to switch from os.tmpnam to os.tmpfile

2006-06-08 Thread Harold Fellermann
Maric Michaud wrote: > Le Jeudi 08 Juin 2006 15:30, Harold Fellermann a écrit : > > to os.tmpfile() which is supposed to be safer, but I do not know how to > > get > > the path information from the file object returned by tmpfile(). any > > clues? > There is no path

Re: how to switch from os.tmpnam to os.tmpfile

2006-06-08 Thread Harold Fellermann
nknown goodies in the library, great :-) - harold - -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching and manipulating lists of tuples

2006-06-12 Thread Harold Fellermann
MTD wrote: > Hello, > > I'm wondering if there's a quick way of resolving this problem. > > In a program, I have a list of tuples of form (str,int), where int is a > count of how often str occurs > > e.g. L = [ ("X",1),("Y",2)] would mean "X" occurs once and "Y" occurs > twice > > If I am given a

Using SQLite3 with python 2.5 beta

2006-06-22 Thread Harold Shore
>From the release notes I read that "If you're compiling the Python source yourself, note that the source tree doesn't include the SQLite code, only the wrapper module. You'll need to have the SQLite libraries and headers installed before compiling Python, and the build process will compile th

Re: mp3 libs and programs

2006-09-15 Thread Harold Fellermann
hi, Jay wrote: > I'm writing a python script that involves playing mp3 files. The first > approach I had was sending commands to unix command-line programs in > order to play them. I tired mpg123 and moosic, but there was a key > feature to my program's success that's missing. SEEK! I need to

MySQLdb for Python 2.5

2006-09-29 Thread Harold Trammel
Hi everyone, Does anyone know the status of a version of MySQLdb that will work with Python 2.5? I will accept a workaround if you know one. Thanks in advance. Harold Trammel -- http://mail.python.org/mailman/listinfo/python-list

Generating text files (newbie)

2006-12-28 Thread Doran, Harold
Assume I have a tab-delimited text file called foo.txt organized as follows: x11 -0.04 x22 -0.42 x33 0.3 My goal is to read in this file and use the information therein to output a new file that is organized as follows: x11 IRM=3PL IPB= -0.04 x22 IRM=3PL IPB= -0.

Beginner question on text processing

2006-12-29 Thread Doran, Harold
I am beginning to use python primarily to organize data into formats needed for input into some statistical packages. I do not have much programming experience outside of LaTeX and R, so some of this is a bit new. I am attempting to write a program that reads in a text file that contains some value

RE: Wow, Python much faster than MatLab

2006-12-30 Thread Doran, Harold
R is the open-source implementation of the S language developed at Bell laboratories. It is a statistical programming language that is becoming the de facto standard among statisticians. Rpy is what allows an interface between python and the R language. Harold > -Original Mess

Re: Question about extending the interperter

2005-05-13 Thread harold fellermann
voked. Consider: >>> g=f >>> print g.func_name f of course, the situation can be much more sphisticated. f could be a value in a dict returned by some other function, and so on. Of course there are ways to inspect the source code (like pdb or exceptions do), but are you sure this is t

Re: Declaring self in PyObject_CallMethod

2005-05-13 Thread harold fellermann
ble_object, PyObject *args, PyObject *kw) i.e. PyObject resultObj = PyObject_Call(doMath,NULL,NULL); If, however, doMath is declared as a class-bound method, you have to use PyObject_CallMethod() with a pointer to an instance of this class as the first argument. Cheers, - harold - --

Re: How do I know when a thread quits?

2005-06-07 Thread harold fellermann
sed. otherwiese, use the higher level Threading module which provides a function Thread.join that allows the main thread to wait for the subthread. I think it uses the same mechanism that I explained above. - harold - -- Outside of a dog, a book is a man's best friend: and inside a dog, i

Re: How do I know when a thread quits?

2005-06-07 Thread harold fellermann
child thread has done a lck.release() but does > not get a chance to quit before execution is whisked away from it and > given to the main thread. Now the main thread sees that the lock has > been released and quits. The child thread hasn't quit yet and we are > back in the same

Re: redirecting messgaef from sys.stdout

2005-06-07 Thread harold fellermann
On 07.06.2005, at 16:43, Ahmad Hosseinzadeh wrote: > Hello, > > I’m trying to run an external program in my > application. Both are coded in python. I need to write > an independent module that is used in the main > application. Its responsibility is to run the external > program and redirect its

Re: How do I know when a thread quits?

2005-06-09 Thread harold fellermann
On 07.06.2005, at 16:44, harold fellermann wrote: > import thread > > def parentThread() : > lock = thread.allocate_lock() > child = thread.start_new_thread(childThread,(parent,)) > lock.acquire() > > def childThread(parent) : >

Re: Controlling assignation

2005-06-13 Thread harold fellermann
is worth mentioning the name of the member to set. IMHO this increases the readability of your source code: >>> a.pressure=5 Cheers, - harold - -- "I was born not knowing and have had only a little time to change that here and there." -- Richard Feynman -- http://mail.python.org/mailman/listinfo/python-list

Re: string formatting using the % operator

2005-06-13 Thread harold fellermann
archterm ='%'+'smith'+'%' >sql += 'WHERE name LIKE %s' % searchterm > > Any Ideas? >>> "%%%s%%" % "here you go" '%here you go%' Cheers, - harold - -- If your only tool is a hammer, every problem looks like a nail. -- -- http://mail.python.org/mailman/listinfo/python-list

extending Python base class in C

2005-06-13 Thread harold fellermann
pass Unfortunately, google could not find me the right reference. Does anyone know how to do it, or where I can find relevant information? Thanks, - harold - -- Je me suis enfermé dans mon amour -- je rève. -- Paul Eluard -- http://mail.python.org/mailman/listinfo/python-list

Re: Controlling assignation

2005-06-13 Thread harold fellermann
On 13.06.2005, at 19:23, Terry Reedy wrote: > > "harold fellermann" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> if you write >>>>> a=A() >> an instance of class A is created and bound to the local identifier >>

Re: translating C++ exceptions to python

2005-06-14 Thread harold fellermann
. AFAIK it has fascilities to transform exceptions from one type into the other. - harold - --- Everybody lies. but it does not matter, as no one listens. --- -- http://mail.python.org/mailman/listinfo/python-list

Problem with simple C extension

2005-06-14 Thread harold fellermann
sicsDPDType) < 0) return; Py_INCREF(&hyper_PhysicsDPDType); PyModule_AddObject(m, "physics_DPD", (PyObject *)&hyper_PhysicsDPDType); } Now, compilation and import works without problem. But I cannot assign members in the init-call. >>> import simulatio

Re: Problem with simple C extension

2005-06-14 Thread harold fellermann
On 14.06.2005, at 18:58, harold fellermann wrote: > Am I stupid or what? Yes I was ... > // PhysicsDPD instance structure > typedef struct { >PyObject_HEAD >double cutoff; >double friction; >double noise; >double

Re: extending Python base class in C

2005-06-14 Thread harold fellermann
> "harold fellermann" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > Hi all, > > I once read that it is possible to use a python base class for a C > extension class. On 14.06.2005, at 09:29, Grigoris Tsolakidis wrote: > There was good

Re: extending Python base class in C

2005-06-15 Thread harold fellermann
simple purposes it works just fine. - harold - -- "Mr Ghandi, what do you think of western civilization?" "Oh, this would be a great idea." -- http://mail.python.org/mailman/listinfo/python-list

Re: dir() with string as argument

2005-06-16 Thread harold fellermann
to import the module: name = "sys" mod = __import__(name) dir(mod) - harold - -- Bitte verlassen Sie diese Welt so, wie Sie sie vorfinden möchten. -- -- http://mail.python.org/mailman/listinfo/python-list

Output to csv

2007-07-25 Thread Doran, Harold
ed in ways to write better code. If anyone has any suggestions, they are most appreciated. Below is the program in its current form. Harold filename = raw_input("Please enter the WinSteps ISF file: ") new_file = raw_input("Enter the name of the csv file to output: ") # create

Sorting Unix mailboxes

2007-08-06 Thread harold barker
Was your mailbox module competed? If so where can i find it? -- http://mail.python.org/mailman/listinfo/python-list

Checking if elements are empty

2007-09-05 Thread Doran, Harold
Dear list: Suppose I have a string as follows x = ' \t'ff' I can split this up as y = x.split('\t') Which gives [ ' ', 'ff'] len(y) 2 Is there a way to check if the first element of y is null? -- http://mail.python.org/mailman/listinfo/python-list

Re: design question: no new attributes

2007-03-14 Thread Harold Fellermann
Something like: class Foo(object) : def __init__(self) : self._locked = False But no! The initialization would trigger Foo.__setattr__(foo,'_locked',False) which naturally runs into an attribute error since __setattr__ looks up this attribute. So this very same implementation is one of the pro examples you asked for :-) cheers, - harold - -- http://mail.python.org/mailman/listinfo/python-list

passing options to __import__

2007-04-03 Thread Harold Fellermann
trying, or do I need to fall back on a config module/class? Thanks! - harold - -- http://mail.python.org/mailman/listinfo/python-list

Re: why did MIT drop scheme for python in intro to computing?

2007-10-09 Thread Harold Ancell
ool, much like S-expressions in LISP), I looked hard at the beginning of 6.01 where they're only teaching SICP. For that purpose, Python is not "awful" (remember, I believe LISP is the One True Way of Computing). For that initial bit of SICP material, I do not believe the student

Re: Better writing in python

2007-10-24 Thread Harold Fellermann
ry But please, give us some more context of what you want to do. - harold - -- http://mail.python.org/mailman/listinfo/python-list

Re: Protocols for Python?

2006-04-27 Thread Harold Fellermann
[EMAIL PROTECTED] wrote: > Still, I'm designing an application that I want to be extendable by > third-party developers. I'd like to have some sort of documentation > about what behavior is required by the components that can be added to > extend the application. I'd thought I might try documenting

Re: python game with curses

2006-04-28 Thread Harold Fellermann
Jerry, if you want anyone to answer your question, please read this: http://www.catb.org/~esr/faqs/smart-questions.html -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >