Re: Delete lines containing a specific word

2008-01-06 Thread sj26
Francesco Pietra wrote: > > Please, how to adapt the following script (to delete blank lines) to > delete > lines containing a specific word, or words? > > f=open("output.pdb", "r") > for line in f: > line=line.rstrip() > if line: > print line > f.close() > > If pytho

Re: python interfaces

2008-01-06 Thread r . grimm
On Jan 6, 11:01 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Interfaces are a extremly smart Design Principle in static typed > > languages like Java and C++. > > that's somewhat questionable in itself, and even more questionable as an > argument for interfaces in Pyt

Re: dictionary/hash and '1' versus 1

2008-01-06 Thread Paddy
On Jan 5, 11:07 pm, [EMAIL PROTECTED] wrote: > Paddy: > > > Not really, it seems to me to be going the exact opposite way with > > languages with automatic type conversions being seen as not suited for > > larger programs. > > In Java you can add the number 1 to a string, and have it > automaticall

whats wrong with this

2008-01-06 Thread mpho raborife
I'm trying to rum gmmtrain within my pthon program like this: os.system(gmmtrain -o output -i Input -l List -t inittype -e traintype -m mixture -d dimension -v vfloor -n number -p percent -r results -c cycle) But i keep on getting an error. - Looking for

Re: Delete lines containing a specific word

2008-01-06 Thread Francesco Pietra
As I said I am no expert in OS and commands, except on what concerns mechanical statistical and quantum mechanical calculations. Therefore, better for me (and for all guys here) if I stop on this matter. My reply is only to say that I did the job with: f=open("prod1-3_no_wat_pop.pdb", "r") for lin

Re: Delete lines containing a specific word

2008-01-06 Thread Francesco Pietra
--- Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sun, 06 Jan 2008 13:33:52 -0800, Francesco Pietra wrote: > > > Steven: > > Thanks. See below please (of very marginal interest) > > > > --- Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > > >> On Sun, 06 Jan 2008 09:21:33 -0800, Francesco Piet

Re: Delete lines containing a specific word

2008-01-06 Thread Steven D'Aprano
On Mon, 07 Jan 2008 00:42:01 +, Grant Edwards wrote: >> If you want to delete them, you still have to do the rest of the job >> yourself. > > Nonsense. > > How is this not doing what the OP asks? > >grep -v pattern infile >outfile; mv outfile infile It isn't deleting lines. As abstract

python-list@python.org

2008-01-06 Thread Steven D'Aprano
On Mon, 07 Jan 2008 12:25:07 +1100, Ben Finney wrote: > John Nagle <[EMAIL PROTECTED]> writes: > >> For our own purposes, I rewrote "htmldecode" to require a sequence >> ending in ";", which means some bogus HTML escapes won't be recognized, >> but correct HTML will be processed correctly. What's

Re: Delete lines containing a specific word

2008-01-06 Thread Steven D'Aprano
On Mon, 07 Jan 2008 00:33:36 +0100, Bjoern Schliessmann wrote: > Steven D'Aprano wrote: > >> grep doesn't delete lines. grep matches lines. If you want to delete >> them, you still have to do the rest of the job yourself. > > In which way does "grep -v mypattern myfile > myfile" not delete the >

Re: Why python says "unexpected parameter 'mini.py'" for my code?

2008-01-06 Thread Oyster
you need wx-c.so from wxnet.sourceforge.net on linux My source uses wx-c.dll, because I am in ms win2k On Jan 4, 10:30 pm, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > oyster <[EMAIL PROTECTED]> wrote: > > The following is my pure-python wxwidgets test. > > It is hardly pure python since it depend

Re: ctypes

2008-01-06 Thread Gary Herron
[EMAIL PROTECTED] wrote: > I am having trouble with ctypes: i can load the third party dll, and > gain access to the function but the function calls do not actually > perform their intended purpose. I have tried this in both interactive > mode and from a saved script. I know that is a somewhat va

python-list@python.org

2008-01-06 Thread Ben Finney
John Nagle <[EMAIL PROTECTED]> writes: > For our own purposes, I rewrote "htmldecode" to require a sequence > ending in ";", which means some bogus HTML escapes won't be > recognized, but correct HTML will be processed correctly. What's > general opinion of this behavior? Too strict, or OK? I thi

ctypes

2008-01-06 Thread hkimball
I am having trouble with ctypes: i can load the third party dll, and gain access to the function but the function calls do not actually perform their intended purpose. I have tried this in both interactive mode and from a saved script. I know that is a somewhat vague description but any help woul

python-list@python.org

2008-01-06 Thread John Nagle
Another in our ongoing series on "Parsing Real-World HTML". It's wrong, of course. But Firefox will accept as HTML escapes & > < as well as the correct forms & > < To be "compatible", a Python screen scraper at http://zesty.ca/python/scra

Re: Delete lines containing a specific word

2008-01-06 Thread Grant Edwards
On 2008-01-06, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sun, 06 Jan 2008 13:33:52 -0800, Francesco Pietra wrote: > >> Steven: >> Thanks. See below please (of very marginal interest) >> >> --- Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> >>> On Sun, 06 Jan 2008 09:21:33 -0800, Francesco Pi

Re: Basic inheritance question

2008-01-06 Thread Neil Cerutti
On Jan 6, 2008 6:59 PM, Dan Bishop <[EMAIL PROTECTED]> wrote: > > My employer has us use the "m_" convention. > > I wonder why Bjarne made "this->" optional in the first place. > -- > http://mail.python.org/mailman/listinfo/python-list > I think implicit this-> is somewhat more defensible. If 'th

Re: Basic inheritance question

2008-01-06 Thread Dan Bishop
On Jan 5, 4:53 am, Bjoern Schliessmann wrote: > [EMAIL PROTECTED] wrote: > > Jeroen Ruigrok van der Werven wrote: > >> self.startLoc = start > >> self.stopLoc = stop > > > Thanks! Of course it should. Old Java habits die slowly. > > That's not really a Java habit. In Java and C++, personally I lik

Re: Delete lines containing a specific word

2008-01-06 Thread bukzor
On Jan 6, 3:33 pm, Bjoern Schliessmann wrote: > Steven D'Aprano wrote: > > grep doesn't delete lines. grep matches lines. If you want to > > delete them, you still have to do the rest of the job yourself. > > In which way does "grep -v mypattern myfile > myfile" not delete the > lines matching myp

Re: how to use bool

2008-01-06 Thread bukzor
On Jan 6, 8:56 am, [EMAIL PROTECTED] wrote: > some more doubts in this area,,forgive the ignorance of a beginner > > i have > > class MyError(Exception): >def __init__(self,msg) > self.msg=msg > > now my method that can raise this is > > class SomeClass: > ... >def mymetho

Re: Delete lines containing a specific word

2008-01-06 Thread Bjoern Schliessmann
Steven D'Aprano wrote: > grep doesn't delete lines. grep matches lines. If you want to > delete them, you still have to do the rest of the job yourself. In which way does "grep -v mypattern myfile > myfile" not delete the lines matching mypattern? Regards, Björn -- BOFH excuse #184: loop fo

Re: Noob question

2008-01-06 Thread GHZ
Had the same issue. What you want is: reload() -- http://mail.python.org/mailman/listinfo/python-list

Noob question

2008-01-06 Thread rocco . rossi
Tinkering with Python I find myself often writing scripts and then experimenting with the interactive interpreter, which is really a cool way to learn a language. However, when, after loading a module with import or from module import * and using it, I make a change to the module file, the cha

Patches to Python 2.5.1

2008-01-06 Thread Brad
I was just looking through the 2.5.1 source code. I noticed a few mis-spellings in the comments. No big deal really. Can patches be submitted that correct the spelling errors or should they just be pointed out to some mailing list? Thanks, Brad -- http://mail.python.org/mailman/listinfo/python

Re: fastest method to choose a random element

2008-01-06 Thread bukzor
On Jan 5, 5:36 pm, [EMAIL PROTECTED] wrote: > On Jan 5, 9:50 pm, Paul Hankin <[EMAIL PROTECTED]> wrote: > > > > > On Jan 5, 5:12 pm, Paul Hankin <[EMAIL PROTECTED]> wrote: > > > > On Jan 5, 4:14 pm, [EMAIL PROTECTED] wrote: > > > > > On Jan 5, 5:07 pm, [EMAIL PROTECTED] wrote: > > > > > > Hello, Pa

Python In VS

2008-01-06 Thread James Matthews
Dear List I would like to know is it possible to use VS (Visual Studio) as a python IDE! It's a great IDE for C# and i would like to be able to use it for python also! Thanks James -- http://search.goldwatches.com/?Search=Movado+Watches http://www.jewelerslounge.com http://www.goldwatches.com -

Re: Delete lines containing a specific word

2008-01-06 Thread Steven D'Aprano
On Sun, 06 Jan 2008 13:33:52 -0800, Francesco Pietra wrote: > Steven: > Thanks. See below please (of very marginal interest) > > --- Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> On Sun, 06 Jan 2008 09:21:33 -0800, Francesco Pietra wrote: >> >> > Please, how to adapt the following script (to

Re: Basic inheritance question

2008-01-06 Thread Francesco Guerrieri
On Jan 5, 2008 11:31 AM, <[EMAIL PROTECTED]> wrote: > import tok > > class code: > def __init__( self, start, stop ): > startLoc = start > stopLoc = stop > > class token(code): > pass > Apart from the missing self, remember that the __init__(...) of the base classes is no

Re: Delete lines containing a specific word

2008-01-06 Thread Martin Marcher
On Sunday 06 January 2008 21:25 Francesco Pietra wrote: >> yes lines starting with a "#" are comments in python but that shouldn't >> be of concern for your input data. I don't quite get what you want >> here... > > Leaving the lines commented out would permit to resume them or at least > remeber

Re: Delete lines containing a specific word

2008-01-06 Thread Francesco Pietra
Steven: Thanks. See below please (of very marginal interest) --- Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sun, 06 Jan 2008 09:21:33 -0800, Francesco Pietra wrote: > > > Please, how to adapt the following script (to delete blank lines) to > > delete lines containing a specific word, or wor

Re: Delete lines containing a specific word

2008-01-06 Thread Steven D'Aprano
On Sun, 06 Jan 2008 09:21:33 -0800, Francesco Pietra wrote: > Please, how to adapt the following script (to delete blank lines) to > delete lines containing a specific word, or words? That's tricky, because deleting lines from a file isn't a simple operation. No operating system I know of (Windo

Re: Delete lines containing a specific word

2008-01-06 Thread Francesco Pietra
--- Martin Marcher <[EMAIL PROTECTED]> wrote: > On Sunday 06 January 2008 18:21 Francesco Pietra wrote: > > > Please, how to adapt the following script (to delete blank lines) to > > delete lines containing a specific word, or words? > > > > f=open("output.pdb", "r") > > for line in f: > > line

Re: Delete lines containing a specific word

2008-01-06 Thread Martin Marcher
On Sunday 06 January 2008 18:21 Francesco Pietra wrote: > Please, how to adapt the following script (to delete blank lines) to > delete lines containing a specific word, or words? > > f=open("output.pdb", "r") > for line in f: > line=line.rstrip() > if line: > print line > f.close() >>> import r

Re: Basic inheritance question

2008-01-06 Thread Bruno Desthuilliers
Lie a écrit : > On Jan 5, 5:40 pm, [EMAIL PROTECTED] wrote: > >>Jeroen Ruigrok van der Werven wrote: >> >> >>>Shouldn't this be: >> >>>self.startLoc = start >>>self.stopLoc = stop >> >>Thanks! Of course it should. Old Java habits die slowly. > > > No, seriously it isn't Java habits only, most ot

Re: python interfaces

2008-01-06 Thread Bruno Desthuilliers
Sion Arrowsmith a écrit : > hyperboreean <[EMAIL PROTECTED]> wrote: > >>Why doesn't python provide interfaces trough its standard library? > > > Because they're pointless. (snip rant about Java's "interfaces") Hem... Zope3's "interface" system is not exactly the same thing as Java's one. --

Re: Request for help with Image color space conversion

2008-01-06 Thread caca
> > ...where the image data is loaded into a numpy array > (1600x1200x3)... One comment: that is a big array, too big for the cache memory. I know that in these cases it makes a difference how many times the slices of the array are loaded and unloaded from RAM onto cache. One issue is that a 2D a

Re: Delete lines containing a specific word

2008-01-06 Thread Grant Edwards
On 2008-01-06, Matt Nordhoff <[EMAIL PROTECTED]> wrote: >> Please, how to adapt the following script (to delete blank lines) to delete >> lines containing a specific word, or words? > If you're on Linux, why not just use grep? > > $ grep -v theword output.pdb And if you're on Windows, install Cy

jonathan ballet?

2008-01-06 Thread marion battentier
je m'interroge si ceci est ta nouvelle adresse... je te cherchais a tout hazard sur internet... bises marion battentier de la rochette, tu te souviens??-- http://mail.python.org/mailman/listinfo/python-list

Re: how to use bool

2008-01-06 Thread Scott David Daniels
[EMAIL PROTECTED] wrote: > ...if another method in the same class calls this method but wants to > pass the error to a gui code which calls it,,can i do like this > > def callingmethode(self): > try: > mymethod() > except MyError,myerr: > raise myerr > > so that I

Re: Unexpected __metaclass__ method behavior

2008-01-06 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Well, you see, I have some database functions that deal with "things" > which are either classes or instances thereof. I though polymorphism > would be a nice way to handle them identically, like: > > def do(thing): thing.Foo() > do(t) > do(Test) > > But never mind,

Re: Point Object

2008-01-06 Thread bearophileHUGS
Pete: > Translate the hexadecimal form > into decimal and confirm that they match. No need to convert the IDs... Soviut: > You shouldn't have to compare the hex IDs. Just a simple comparison > operator will work: > > firstPoint = Point() > secondPoint = Point() > print(firstPoint == secondPoint

Re: Cost of "unicode(s)" where s is Unicode

2008-01-06 Thread Aahz
In article <[EMAIL PROTECTED]>, JKPeck <[EMAIL PROTECTED]> wrote: > u = u"abc" uu = unicode(u) u is uu >True s = "abc" ss = unicode(s) s is ss >False You uuencode Unicode? -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ Sorry, couldn't

Fwd: Delete lines containing a specific word

2008-01-06 Thread Francesco Pietra
I forgot to add that the lines to strip are in present case of the type of the following block HETATM 7007 O WAT 446 27.622 34.356 55.205 1.00 0.00 O HETATM 7008 H1 WAT 446 27.436 34.037 56.145 1.00 0.00 H HETATM 7009 H2 WAT 446 27.049 33.82

Re: Delete lines containing a specific word

2008-01-06 Thread Matt Nordhoff
Francesco Pietra wrote: > Please, how to adapt the following script (to delete blank lines) to delete > lines containing a specific word, or words? > > f=open("output.pdb", "r") > for line in f: > line=line.rstrip() > if line: > print line > f.close() > > If python in Li

Delete lines containing a specific word

2008-01-06 Thread Francesco Pietra
Please, how to adapt the following script (to delete blank lines) to delete lines containing a specific word, or words? f=open("output.pdb", "r") for line in f: line=line.rstrip() if line: print line f.close() If python in Linux accepts lines beginning with # as co

Re: how to use bool

2008-01-06 Thread jimgardener
forget about syntax err.. sorry ..but still would like to know if raising exception inside an except clause the right way? -- http://mail.python.org/mailman/listinfo/python-list

Re: python interfaces

2008-01-06 Thread Carl Banks
On Sat, 05 Jan 2008 23:31:02 -0800, r.grimm wrote: > They force the user of a framework to use it in a defined way. This is the arrogance of the provider thinking that he can anticipate all the needs of the user. Even when interfaces exist, they should be there to guide the user rather than to

Re: list property fires get on append

2008-01-06 Thread Carl Banks
On Sun, 06 Jan 2008 00:31:13 -0800, Soviut wrote: > I figured that an append would be treated as a set since I'm adding to > the list. But what you say makes sense, although I can't say I'm happy > with the behaviour. Is there any way I can get the append to fire a > set? I'm thinking of propert

Re: how to use bool

2008-01-06 Thread jimgardener
some more doubts in this area,,forgive the ignorance of a beginner i have class MyError(Exception): def __init__(self,msg) self.msg=msg now my method that can raise this is class SomeClass: ... def mymethod(self): if (somecondition): raise MyError("somec

Re: Cost of "unicode(s)" where s is Unicode

2008-01-06 Thread JKPeck
On Jan 6, 9:06 am, John Nagle <[EMAIL PROTECTED]> wrote: >Does > > text = unicode(text) > > make a copy of a Unicode string, or is that essentially a > free operation if the input is already Unicode? > > John Nagle >>> u = u"abc" >>> uu = unicode(u) >>>

Re: Cost of "unicode(s)" where s is Unicode

2008-01-06 Thread Christian Heimes
John Nagle wrote: >Does > > text = unicode(text) > > make a copy of a Unicode string, or is that essentially a > free operation if the input is already Unicode? >>> u = u"some long unicode object" >>> unicode(u) is u True -- http://mail.python.org/mailman/listinfo/python-list

Re: Cost of "unicode(s)" where s is Unicode

2008-01-06 Thread Rob Williscroft
John Nagle wrote in news:[EMAIL PROTECTED] in comp.lang.python: >Does > > text = unicode(text) > > make a copy of a Unicode string, or is that essentially a > free operation if the input is already Unicode? > > John Nagle > http://docs.python.org/lib/built-in-fun

Cost of "unicode(s)" where s is Unicode

2008-01-06 Thread John Nagle
Does text = unicode(text) make a copy of a Unicode string, or is that essentially a free operation if the input is already Unicode? John Nagle -- http://mail.python.org/mailman/listinfo/python-list

Re: C++ equivalent of comp.lang.python?

2008-01-06 Thread Leo Jay
On Jan 4, 2008 1:39 AM, <[EMAIL PROTECTED]> wrote: > Hopefully this isn't too OT. > > One thing I like about comp.lang.python is the breadth of topics > discussed here. People can ask about Python installation and > configuration issues on specific platforms, compare third party > libraries, ask

Re: Killing worker threads

2008-01-06 Thread Fredrik Lundh
James Matthews wrote: > You can use the stop method! You can? >>> import threading >>> t = threading.Thread() >>> t.stop() Traceback (most recent call last): File "", line 1, in AttributeError: 'Thread' object has no attribute 'stop' >>> What Python version are you using? -- http://

Re: Killing worker threads

2008-01-06 Thread Fredrik Lundh
tarun wrote: > Can anyone help me with a simple code through which the main thread can > kill the worker thread it started. it cannot. threads cannot be killed from the "outside". -- http://mail.python.org/mailman/listinfo/python-list

Re: Killing worker threads

2008-01-06 Thread James Matthews
You can use the stop method! On Jan 6, 2008 2:04 PM, tarun <[EMAIL PROTECTED]> wrote: > Hello All, > > Can anyone help me with a simple code through which the main thread can > kill the worker thread it started. > > Thanks & Regards, > Tarun Devnani > > -- > http://mail.python.org/mailman/listinf

Re: how to use bool

2008-01-06 Thread Paul Hankin
On Jan 3, 3:49 pm, [EMAIL PROTECTED] wrote: > hi, i have some code where i set a bool type variable and if the value > is false i would like to return from the method with an error msg.. > being a beginner I wd like some help here > > class myclass: >      . >     def  mymethod(self): >    

Re: fastest method to choose a random element

2008-01-06 Thread ajaksu
On Jan 5, 11:36 pm, [EMAIL PROTECTED] wrote: > > This one is good. Someone commented that you destroy the list, but > that can be fixed: > > def pick_random(seq, prop): > L = len(seq) > for i in xrange(L): > r = random.randrange(L - i) > if prop(seq[r]): >

Killing worker threads

2008-01-06 Thread tarun
Hello All, Can anyone help me with a simple code through which the main thread can kill the worker thread it started. Thanks & Regards, Tarun Devnani -- http://mail.python.org/mailman/listinfo/python-list

Re: fastest method to choose a random element

2008-01-06 Thread Dustan
On Jan 5, 4:16 am, [EMAIL PROTECTED] wrote: > The warning "The group you are posting to is a Usenet group. Messages > posted to this group will make your email address visible to anyone on > the Internet." means a person, but not a bot, may see my email > address, so it is safe to use my real addre

Re: list property fires get on append

2008-01-06 Thread Diez B. Roggisch
Soviut schrieb: > On Jan 6, 3:03 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> I've created a class that has a property which points at a private >>> list. When I try to use the append() function on this list property, >>> the fget method is fired rather than the fse

Re: Point Object

2008-01-06 Thread Soviut
On Jan 5, 6:37 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I am nes to python and need some help. Can anyone lead me in the > right direction to create and print a Point object, and then use id to > print the object's unique identifier. Translate the hexadecimal form > into decimal and co

Re: python interfaces

2008-01-06 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Interfaces are a extremly smart Design Principle in static typed > languages like Java and C++. that's somewhat questionable in itself, and even more questionable as an argument for interfaces in Python. I'd recommend anyone who thinks that they cannot program without

Re: list property fires get on append

2008-01-06 Thread Soviut
On Jan 6, 3:03 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I've created a class that has a property which points at a private > > list. When I try to use the append() function on this list property, > > the fget method is fired rather than the fset method. If I dir

**********ssssssssssssssex with needsssssssssssss**

2008-01-06 Thread vadivel59
**ssex with needs** * u like mee** * uuu lilke boobs*** *** http://www.geocities.com/gurus68/ ** -- http://mail.python.org/mailman/list

Re: list property fires get on append

2008-01-06 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I've created a class that has a property which points at a private > list. When I try to use the append() function on this list property, > the fget method is fired rather than the fset method. If I directly > set my property to a literal list, the set method fires. >

Re: how to use bool

2008-01-06 Thread jimgardener
hi bukzor & everyone who replied thanks for the detailed replies will try to write that way thanx a lot jim bukzor wrote: > On Jan 4, 8:51 am, bukzor <[EMAIL PROTECTED]> wrote: > > #exercise of the class and error handling > m = myclass() > try: > m.mymethod() > print "Completed success