Re: What is different with Python ?

2005-06-15 Thread Andrea Griffini
On Tue, 14 Jun 2005 16:40:42 -0500, Mike Meyer <[EMAIL PROTECTED]> wrote: >Um, you didn't do the translation right. Whoops. So you know assembler, no other possibility as it's such a complex language that unless someone already knows it (and in the specific architecture) what i wrote is pure lin

Re: What is different with Python ?

2005-06-15 Thread Peter Maas
Magnus Lycka schrieb: > Peter Maas wrote: > >> Learning is investigating. By top-down I mean high level (cat, >> dog, table sun, sky) to low level (molecules, atoms, fields ...). > > > Aha. So you must learn cosmology first then. I don't think so. ;) I wasn't talking about size but about sensua

Single test for a class and all its subclasses?

2005-06-15 Thread Anthra Norell
class C: ... class C2 (C): ...     # What I want to do:   if x.__class__ in (C, C2):    do_something_with (x)   # Requires an exhaustive genealogy, which normally is impractical and often impossible     # Another approach   class_tree = inspect.getclasstree ((x.__class__,)) if classtree_con

Europython update

2005-06-15 Thread Jacob Hallen
The Europython schedule was publised on the Europython website (http://www.europython.org) today. With five parallel sessions for half of the conference and four for the rest, we think we have the largest selection of Python and Zope talks ever. "Actually, we are more proud of the quality of the t

Re: "also" to balance "else" ?

2005-06-15 Thread Fredrik Lundh
Ron Adam wrote: > So the (my) confusion comes from the tendency to look at it in terms of > overall program flow rather than in terms of the specific conditional > logic. > > In a for loop the normal, as in terminating normally, behavior of a loop > is one where the loop test evaluates as 'False'

Re: Cause for using objects?

2005-06-15 Thread Michael Hoffman
John Heasly wrote: > I'm thinking maybe list comprehension is a more appropriate > tool. You have a 1-to-3 relationship between the items of your input list and the items of your output dict. I find listcomps are best for 1-to-1 relationships. Personally I would just use a for loop. > And I n

Re: What is different with Python ?

2005-06-15 Thread James
If you're thinking of things like superstrings, loop quantum gravity and other "theories of everything" then your friend has gotten confused somewhere. There is certainly no current experiments which we can do in practise, which is widely acknowledged as a flaw. Lots of physicists are trying to wor

Re: Single test for a class and all its subclasses?

2005-06-15 Thread Konstantin Veretennicov
On 6/15/05, Anthra Norell <[EMAIL PROTECTED]> wrote: > > class C: ... > class C2 (C): ... > > # What I want to do: > > if x.__class__ in (C, C2): >do_something_with (x) If you have an instance, you can use isinstance() built-in. - kv -- http://mail.python.org/mailman/listinfo/pyth

Re: Tkinter question

2005-06-15 Thread Martin Franklin
I realise I was a bit short on advice earlier... Martin Franklin wrote: > [EMAIL PROTECTED] wrote: > >>I'm sure there must be a way to do this, but I can't figure it out for >>the life of me… I'm writing a program where I would like to use a >>button's text field as part of an if statement. I

dynamic

2005-06-15 Thread Riccardo Galli
Hi all. It's easier if I show an example first. Say I have class A(object): def speak(self): print 'A!' class B(object): def speak(self): print 'B!' I also have a factory function like this. def foo(kind,*args,**kwds): if kind=='a': return A(*args,**kwds) else: return B(*args,**k

__new__ and dynamic inheriting

2005-06-15 Thread Riccardo Galli
Hi all. It's easier if I show an example first. Say I have class A(object): def speak(self): print 'A!' class B(object): def speak(self): print 'B!' I also have a factory function like this. def foo(kind,*args,**kwds): if kind=='a': return A(*args,**kwds) else: return B(*args,**k

Re: dynamic

2005-06-15 Thread Michele Simionato
Having a class that returns instances of some other class is horrible, but since you asked for it: class A(object): pass class B(object): pass class Foo(object): def __new__(cls, arg): if arg=="a": return A() else: return B() print Foo("a") print Foo("

Does Python cause tides?

2005-06-15 Thread Peter Hansen
Steven D'Aprano wrote: > Roy Smith wrote: >> Steven D'Aprano <[EMAIL PROTECTED]> wrote: >> >High and low tides aren't caused by the moon. >> They're not??? > > Nope. They are mostly caused by the continents. ... > The true situation is that tides are caused by the interaction of the > gravitation

Re: implicit variable declaration and access

2005-06-15 Thread Tom Anderson
On Tue, 14 Jun 2005, Scott David Daniels wrote: > Tom Anderson wrote: >> ... If it's not, try: >> x = "myVarName" >> y = "myVarValue" >> locals()[x] = y > > Sorry, this works with globals(), but not with locals(). Oh, weird. It works when i tried it. Aaaah, i only tried it at the interactive pro

Re: Tkinter question

2005-06-15 Thread Peter Otten
[EMAIL PROTECTED] wrote: [I didn't see the original post, so just in case noone mentioned it] > if(self.buttonx.title.isdigit): Nicholas, the method is not called unless you add parentheses, e. g: >>> "1".isdigit # a bound method *always* True in a boolean context >>> "1".isdigit() # True only

Re: dynamic

2005-06-15 Thread Riccardo Galli
On Wed, 15 Jun 2005 03:12:07 -0700, Michele Simionato wrote: > Having a class that returns instances of some other class is horrible, but > since you asked for it: > > class A(object): pass > class B(object): pass > > class Foo(object): > def __new__(cls, arg): > if arg=="a": >

Re: Elementtree and CDATA handling

2005-06-15 Thread Fredrik Lundh
Terry Reedy wrote: >> the above are six ways to write the same string literal in Python. > > Minor nit: I believe 'hell' + 'o' is two string literals and a runtime > concatenation operation. I guess I should have written "constant". on the other hand, while the difference might matter for curre

Strange socket problem

2005-06-15 Thread huy
Hi, I'm using cherrypy to provide a user interface for users to start a linux server program eg. os.system("nohup myserver.py &"). The problem is that if I stop cherrypy server and restart, I get the "Address Already In Use" problem until I stop myserver.py. Can someone shed some light on why

Re: dynamic

2005-06-15 Thread Dan Sommers
On Wed, 15 Jun 2005 13:13:49 +0200, Riccardo Galli <[EMAIL PROTECTED]> wrote: > I have n classes wich share the same interface. I then have a single > class which add functionality to all the n classes, using their > interface. The only way I see to make this single class inherith from > the cho

Re: Tkinter question

2005-06-15 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I'm sure there must be a way to do this, but I can't figure it out for > the life of me... I'm writing a program where I would like to use a > button's text field as part of an if statement. I set up my button like > this: > > i = [ "7", "8","9", "/", "4", "5", "6", "*"

Re: What is different with Python ?

2005-06-15 Thread Andrea Griffini
On Wed, 15 Jun 2005 10:27:19 +0100, James <[EMAIL PROTECTED]> wrote: >If you're thinking of things like superstrings, loop quantum gravity >and other "theories of everything" then your friend has gotten >confused somewhere. More likely I was the one that didn't understand. Reading what wikipedia

Re: Strange socket problem

2005-06-15 Thread Jeff Epler
When using os.system(), files that are open in the parent are available in the child, as you can see here in Linux' listing of the files open by the child program: [EMAIL PROTECTED] jepler]$ python -c 'f = open("/tmp/test", "w"); print f.fileno(); import os; os.system("ls -l /proc/self/fd")' 3 to

FAQ: __str__ vs __repr__

2005-06-15 Thread Jan Danielsson
Sorry, but I Just Don't Get It. I did search the 'net, I did read the FAQ, but I'm too dumb to understand. As far as I can gather, __str__ is just a representation of the object. For instance: class ServerConnection: def __str__(self): buf = "Server: " + self.name + "\n" buf +

Re: FAQ: __str__ vs __repr__

2005-06-15 Thread =?iso-8859-1?q?S=E9bastien_Boisg=E9rault?=
Jan Danielsson a écrit : > Sorry, but I Just Don't Get It. I did search the 'net, I did read the > FAQ, but I'm too dumb to understand. > >As far as I can gather, __str__ is just a representation of the > object. ... yep, and this representation is built for human eyes. Don't worry too much if

Re: What is different with Python ?

2005-06-15 Thread Roy Smith
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Roy Smith wrote: > > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > > > >High and low tides aren't caused by the moon. > > > > > > They're not??? > > Nope. They are mostly caused by the continents. If the > Earth was completely covered by ocean, th

Re: FAQ: __str__ vs __repr__

2005-06-15 Thread =?iso-8859-1?q?S=E9bastien_Boisg=E9rault?=
Errata: >>> str(0.1) '0.1' >>> str("it's a bad idea") "it's a bad idea" >>> repr(0.1) ' 0.10001' >>> repr("it's a bad idea") '"it\'s a bad idea"' SB -- http://mail.python.org/mailman/listinfo/python-list

Re: FAQ: __str__ vs __repr__

2005-06-15 Thread Andreas Kostyrka
Well, It means that eval(repr(x)) == x if at all possible. Basically: repr('abc') -> 'abc' str('abc') -> abc You'll notice that 'abc' is a valid python expression for the string, while abc is not a valid string expression. Andreas On Wed, Jun 15, 2005 at 02:46:04PM +0200, Jan Danielsson wrote: >

Re: dynamic

2005-06-15 Thread Kent Johnson
Riccardo Galli wrote: > Hi all. > It's easier if I show an example first. > > Say I have > > class A(object): > def speak(self): print 'A!' > > class B(object): > def speak(self): print 'B!' > > I also have a factory function like this. > > def foo(kind,*args,**kwds): >if kind=='a'

Re: FAQ: __str__ vs __repr__

2005-06-15 Thread Greg Krohn
Basically __repr__ should return a string representaion of the object, and __str__ should return a user-friendly pretty string. So maybe: class Person: ... def __repr__(self): return '' % (self.name, self.age, self.sign) def __str__(self): return self.name See this for a bett

non OO behaviour of file

2005-06-15 Thread Robin Becker
I recently tried to create a line flushing version of sys.stdout using class LineFlusherFile(file): def write(self,s): file.write(self,s) if '\n' in s: self.flush() but it seems that an 'optimization' prevents the overriden write method from being used. I had

Re: dynamic

2005-06-15 Thread =?iso-8859-1?Q?Fran=E7ois?= Pinard
[Michele Simionato] > Having a class that returns instances of some other class is horrible, > [...] don't do it! Unusual, granted. Horrible, why? I found useful, sometimes, (ab)using Python syntax for representing data having more or less complex structure. More than once, it spared me the tr

Re: dynamic

2005-06-15 Thread James Carroll
Returning instances of some other class is not so horrible. They're called FactoryMethods usually. An example is when you have a polymorphic tree of image file reader objects, and you open an image file, it might return a JpegReader which ISA ImageReader or a TIFFReader which also ISA ImageReader

Re: eclipse, pydev and wxpython - standard output redirection ?

2005-06-15 Thread Grzegorz
Uzytkownik "Philippe C. Martin" <[EMAIL PROTECTED]> napisal w wiadomosci news:[EMAIL PROTECTED] > app = MyApp(False) > app.MainLoop() > > will keep wxWidgets from using its own window. > > that's it ! Thanks a lot :) -- http://mail.python.org/mailman/listinfo/python-list

Re: non OO behaviour of file

2005-06-15 Thread Michael Hoffman
Robin Becker wrote: > I recently tried to create a line flushing version of sys.stdout using > > class LineFlusherFile(file): > def write(self,s): > file.write(self,s) > if '\n' in s: > self.flush() > > but it seems that an 'optimization' prevents the overriden wri

Using a base class for a factory function

2005-06-15 Thread Scott David Daniels
Riccardo Galli wrote (approximately): > I need a class to behave as a factory method for its children so that I could > inherit > from it and still use it as a factory. Several others suggest you probably don't want to do this; I concur. Separating the factory from the interface (I presume you

ANN: rest2web, firedrop2, textmacros

2005-06-15 Thread Fuzzyman
Threee related announcements : rest2web - latest update adds support for multiple translations firedrop2 - new documentation and updated reST support textmacros - the textmacros module is now available separrately, useful for systems like docutils First of all my all new `Firedrop2 Section`__ [

Re: extending Python base class in C

2005-06-15 Thread harold fellermann
Yah! Finally, I got the thing to work. Here is how I did it. /* import the module that holds the base class */ PyObject *base_module = PyImport_ImportModule("module_name"); if (!base_module) return; /* get a pointer to the base class */ PyObject *base_class = PyMapping_GetItemString(

Re: how to use pyparsing for identifiers that start with a constant string

2005-06-15 Thread Paul McGuire
Be careful, Kent. You may get tagged as "the new pyparsing guy." :) -- Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: non OO behaviour of file

2005-06-15 Thread Robin Becker
Michael Hoffman wrote: . > > Well, you could use python -u: > unfortunately this is in a detached process and I am just reopening stdout as an ordinary file so another process can do tail -F on it. I imagine ther ought to be an os dependant way to set the file as unbuffered, but can't reme

Re: FAQ: __str__ vs __repr__

2005-06-15 Thread Peter Hansen
Jan Danielsson wrote: > Sorry, but I Just Don't Get It. I did search the 'net, I did read the > FAQ, but I'm too dumb to understand. > > As far as I can gather, __str__ is just a representation of the > object. [snip] > However, I don't understand what __repr__ should be. __repr__ shouldn't b

Re: Opening a drive folder from Python

2005-06-15 Thread John Henry
Thanks, Chad. That works. -- John -- http://mail.python.org/mailman/listinfo/python-list

Re: non OO behaviour of file

2005-06-15 Thread Jp Calderone
On Wed, 15 Jun 2005 16:38:32 +0100, Robin Becker <[EMAIL PROTECTED]> wrote: >Michael Hoffman wrote: >. >> >> Well, you could use python -u: >> > >unfortunately this is in a detached process and I am just reopening stdout >as an ordinary file so another process can do tail -F on it. I imagine th

Re: Strange socket problem

2005-06-15 Thread Magnus Lycka
huy wrote: > Hi, > > I'm using cherrypy to provide a user interface for users to start a > linux server program eg. os.system("nohup myserver.py &"). The problem > is that if I stop cherrypy server and restart, I get the "Address > Already In Use" problem until I stop myserver.py. Can someone s

Tkinter Question

2005-06-15 Thread Nicholas . Vaidyanathan
Title: Tkinter Question Thanks for all the help guys… I'm a bit confused as to the inner workings of the Tkinter system (I'm both a Python and a GUI n00b). I was hoping that by slapping the x on button python was doing some cool dynamic variable creation (i.e. creating 9 variables with 1 loop

Programmatic links in a TKinter TextBox

2005-06-15 Thread Grooooops
I've been hacking around this for a few days and have gotten close to what I want... but not quite... The TKinter Docs provide this example: # configure text tag text.tag_config("a", foreground="blue", underline=1) text.tag_bind("a", "", show_hand_cursor) text.tag_bind("a", "", sho

Re: Python in Games (was RE: [Stackless] Python in Games)

2005-06-15 Thread Don
Irmen de Jong wrote: > Patrick Down wrote: >> My understanding is that the upcoming Civilization IV will have python >> scripting. >> > > Also, alledgedly the new BattleField II uses Python in a way... > because I heard that you had to comment out a certain line > in a certain .py file to remove

Re: Show current ip on Linux

2005-06-15 Thread David Van Mosselbeen
Sibylle Koczian wrote: > David Van Mosselbeen schrieb: >> >> Thanks for support. >> I have read the refered page you show above. I try some piece of code >> that im have copy and paste it into a blank file that i give the name >> "ip_adress.py" to test it. >> >> >> THE SOURCE CODE : >>

Re: Programmatic links in a TKinter TextBox

2005-06-15 Thread Jeff Epler
Based on the location where the user clicked, you can find the associated tags. Then you must loop through them to find the one that gives the "href" value. Jeff :r /tmp/link.py import Tkinter app = Tkinter.Tk() text = Tkinter.Text(app) text.pack() def click(event): #this doesn't work

Re: how to use pyparsing for identifiers that start with a constant string

2005-06-15 Thread Kent Johnson
Paul McGuire wrote: > Be careful, Kent. You may get tagged as "the new pyparsing guy." :) Yeah, I was a little surprised I beat you to that one :-) Kent -- http://mail.python.org/mailman/listinfo/python-list

Re: FAQ: __str__ vs __repr__

2005-06-15 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Jan Danielsson <[EMAIL PROTECTED]> wrote: > Sorry, but I Just Don't Get It. I did search the 'net, I did read the > FAQ, but I'm too dumb to understand. > >As far as I can gather, __str__ is just a representation of the > object. No, it is not. It is a con

Re: Tkinter Question

2005-06-15 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Thanks for all the help guys... I'm a bit confused as to the inner > workings of the Tkinter system (I'm both a Python and a GUI n00b). I was > hoping that by slapping the x on button python was doing some cool > dynamic variable creation (i.e. creating 9 variables with

Re: Strange socket problem

2005-06-15 Thread nm674674
Gurus, I am still doing my baby steps in the wonderful world of python (so far, so good). However, I am quite familiar with sockets. There is a socket option called SO_REUSEADDR that your server should call to fix this problem. -- http://mail.python.org/mailman/listinfo/python-list

Re: What is different with Python ?

2005-06-15 Thread Terry Hancock
On Tuesday 14 June 2005 02:12 pm, Andrew Dalke wrote: > Teaching kids is different than teaching adults. The > latter can often take bigger steps and start from a > sound understanding of logical and intuitive thought. > "Simple" for an adult is different than for a child. Of course, since childr

Re: New WYSIWYG Python IDE in the works

2005-06-15 Thread Christoph Rackwitz
root wrote: > Hello all > > I am currently developing a new WYSIWYG RAD tool for python. > There are screenshots and a small video demo on the site. > Please visit at http://www.geocities.com/visualfltk > > Cheers > JMan -- http://mail.python.org/mailman/listinfo/python-list

Re: What is different with Python ? (OT I guess)

2005-06-15 Thread Terry Hancock
On Tuesday 14 June 2005 10:21 am, Scott David Daniels wrote: > > Oh well, I guess it's a bit late to try to rename the Computer > > Science discipline now. > The best I've heard is "Informatics" -- I have a vague impression > that this is a more European name for the field. It's the reverse-transl

Re: New WYSIWYG Python IDE in the works

2005-06-15 Thread Christoph Rackwitz
(Sorry for that other post of mine. I don't know what went wrong) Don't get me wrong - your project is pretty interesting and you can certainly get valuable experience from it - but to be better than the competition you need to be better than the competition. -- http://mail.python.org/mailman/li

Re: What is different with Python ? (OT I guess)

2005-06-15 Thread Terry Hancock
On Tuesday 14 June 2005 08:12 am, Magnus Lycka wrote: > Oh well, I guess it's a bit late to try to rename the Computer > Science discipline now. Computer programming is a trade skill, not a science. It's like being a machinist or a carpenter --- a practical art. Unfortunately, our society has a v

Re: Programmatic links in a TKinter TextBox

2005-06-15 Thread Grooooops
Many thanks Jeff!!! This is what should be in the TK docs. Your example was very clear. And now I've learned some new stuff... :) For my project, I needed to add three pieces of data per link like this: text.insert(Tkinter.END, "link", ("a", "href:"+href,"another:This Is More Data", "last:and one

Re: Does Python cause tides?

2005-06-15 Thread Terry Hancock
On Wednesday 15 June 2005 05:13 am, Peter Hansen wrote: > I also see nothing to suggest that if the moon and the sun were removed > from the picture, there would be much in the way of tides at all. (The > page you quoted says the sun has about 46% the effect of the moon which, > if true, means

Re: New WYSIWYG Python IDE in the works

2005-06-15 Thread Cappy2112
This is great, but it might be worth finding out what the other IDE's can do first, as well as their weaknesses. Eric3 seems to be the most popular & powerfull. Uop until recentluy, it onluy works on Linux, but has been compiled & runnin on Windows, to some degree of success. QTDesigner is pretty

PIGIP (Python Interest Group In Princeton) Meeting Tonight

2005-06-15 Thread [EMAIL PROTECTED]
Meeting Tonight! Python Interest Group In Princeton (PIGIP -- http://www.pigip.org) PIGIP will hold its sixth meeting on Wednesday June 15, 2005 at the Lawrenceville Library. We don't have a formal topic, but Jon will show off using Archetypes in Plone for easy content managemen

Re: What is different with Python ?

2005-06-15 Thread Claudio Grondi
> Yes, both the sun and the moon have gravitational fields which affect > tides. But the moon's gravitational field is much stronger than the sun's, > so as a first-order approximation, we can ignore the sun. Here we are experiencing further small lie which found its way into a text written by a

Re: "also" to balance "else" ?

2005-06-15 Thread Terry Hancock
On Wednesday 15 June 2005 03:57 am, Fredrik Lundh wrote: > where your "abnormal behaviour" is, of course, the expected > behaviour. if you insist on looking at things the wrong way, > things will look reversed. Unfortunately, the converse is true, too: no matter how twisted an idea is, you can ma

Re: Tkinter question

2005-06-15 Thread Peter Otten
Fredrik Lundh wrote: > note that you're assigning all buttons to the same instance variable, so > even if the above did work, it would always return a plus. > > since the command callback doesn't know what widget it was called > from, you need to create a separate callback for each widget.  here'

Re: FAQ: __str__ vs __repr__

2005-06-15 Thread Terry Hancock
On Wednesday 15 June 2005 08:06 am, Sébastien Boisgérault wrote: > Jan Danielsson a écrit : > >However, I don't understand what __repr__ should be. > It is an *exact* (if possible) description of the object's content, > nicely packaged into a string. However, this is often not the case. Freque

Re: "also" to balance "else" ?

2005-06-15 Thread Ron Adam
Fredrik Lundh wrote: > Ron Adam wrote: > > >>So the (my) confusion comes from the tendency to look at it in terms of >>overall program flow rather than in terms of the specific conditional >>logic. >> >>In a for loop the normal, as in terminating normally, behavior of a loop >>is one where the lo

Re: non OO behaviour of file

2005-06-15 Thread Robin Becker
Jp Calderone wrote: > On Wed, 15 Jun 2005 16:38:32 +0100, Robin Becker <[EMAIL PROTECTED]> wrote: > >>Michael Hoffman wrote: >>. >> >>>Well, you could use python -u: >>> >> >>unfortunately this is in a detached process and I am just reopening stdout >>as an ordinary file so another process can

Re: Tkinter question

2005-06-15 Thread Fredrik Lundh
Peter Otten wrote: > Change the above function to > > def callback(text=text): > self.pressed(text) argh! -- http://mail.python.org/mailman/listinfo/python-list

Read System.out.println From Java Using popen ?

2005-06-15 Thread Your Friend
Hello All, I'm relatively new to Python programming but have been working on this problem for a little bit now ... I initially began writing UNIX scripts in Python and thought it was the greatest because I could do the following very easily : pswwaux = os.popen( "ps wwaux | grep /usr/sbin/httpd"

Re: FAQ: __str__ vs __repr__

2005-06-15 Thread Dave Benjamin
Jan Danielsson wrote: > Sorry, but I Just Don't Get It. I did search the 'net, I did read the > FAQ, but I'm too dumb to understand. Say we define a string "s" as follows: >>> s = 'hello' If we print "s", we see its string form (__str__): >>> print s hello However, if we just examine "s",

Re: Does Python cause tides?

2005-06-15 Thread Roy Smith
Terry Hancock <[EMAIL PROTECTED]> wrote: > is the statement "Viruses are made of DNA" true, or false? False. Viruses were made of Word macros :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python as CGI on IIS and Windows 2003 Server

2005-06-15 Thread and-google
Lothat <[EMAIL PROTECTED]> wrote: > No test with or without any " let the IIS execute python scrits as cgi. > Http Error code is 404 (but i'm sure that the file exists in the > requested path). Have you checked the security restrictions? IIS6 has a new feature whereby script mappings are disabled

Re: Python-list Digest, Vol 21, Issue 234 (Out of the Office June 16)

2005-06-15 Thread Catherine Kostyn
I will be out of the office on June 16, to return on June 17. I will reply to your message at that time. Catherine Kostyn Transportation Planner Indianapolis MPO 200 E. Washington St., Ste. 1821 Indianapolis, IN 46204 (317)327-5142 -- http://mail.python.org/mailman/listinfo/python-list

Re: Tiff Image Reader/writer

2005-06-15 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Robert Kern wrote: > PyPK wrote: >> One reason why I don't want to use PIL is it seems very slow for tiff >> images of very large sizes(2400x4800). So I am looking for a better >> tool than does the right job faster. > > This isn't fast enough? > > In [8]: %time img2 = Im

Re: Tiff Image Reader/writer

2005-06-15 Thread Robert Kern
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Robert Kern > wrote: > >>PyPK wrote: >> >>>One reason why I don't want to use PIL is it seems very slow for tiff >>>images of very large sizes(2400x4800). So I am looking for a better >>>tool than does the right job faster. >> >>This isn't

Re: Does Python cause tides?

2005-06-15 Thread Roel Schroeven
Terry Hancock wrote: > "Plants consume CO2 and make O2" > > Well, yes, but they also consume O2, just like animals. *On balance*, > the statement is *usually* true. But most plants would probably > die in a pure-CO2 environment (unless they can drive the atmosphere > to a better composition fas

Re: What is different with Python ? (OT I guess)

2005-06-15 Thread Renato Ramonda
Terry Hancock ha scritto: > > It's the reverse-translation from the French "Informatique". Or maybe the italian Informatica... -- Renato Usi Fedora? Fai un salto da noi: http://www.fedoraitalia.org -- http://mail.python.org/mailman/listinfo/python-list

Re: __str__ vs __repr__

2005-06-15 Thread John Roth
"Jan Danielsson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Sorry, but I Just Don't Get It. I did search the 'net, I did read the > FAQ, but I'm too dumb to understand. > > As far as I can gather, __str__ is just a representation of the > object. For instance: > > class Serv

pyunit: remove a test case on the fly

2005-06-15 Thread chris
We have a number of TestCase classes that have multiple test methods. We are interested in removing any of the individual test methods on the fly (dynamically, at runtime, whatever). We currently have an "isSupported" method in the TestCase classes that return a bool by which the greater test harn

Re: What is different with Python ? (OT I guess)

2005-06-15 Thread david . tolpin
> > Oh well, I guess it's a bit late to try to rename the Computer > > Science discipline now. > The best I've heard is "Informatics" -- I have a vague impression > that this is a more European name for the field. The word "Informatics" had been invented by a Soviet computer scientist Andrey Ersh

Finding Word and switch focus to it

2005-06-15 Thread John Henry
Does anybody know how to find an opened copy of Word and switch focus to it, wait until Word is closed, before continuing my Python script? I tried to search for the answer from Google and nothing stands out. Running under Windows XP. Thanks, -- John -- http://mail.python.org/mailman/listinfo/

Re: "also" to balance "else" ?

2005-06-15 Thread Nicolas Fleury
Ron Adam wrote: > It occurred to me (a few weeks ago while trying to find the best way to > form a if-elif-else block, that on a very general level, an 'also' > statement might be useful. So I was wondering what others would think > of it. But the feature is already there: for x in : BLO

Re: Strange socket problem

2005-06-15 Thread huy
Hi Jeff, Thanks for your help. Although I haven't confirmed this, I think you just hit my nail on the head. I thought os.system was like a totally separate process though, i.e nothing is shared. not the usual fork() call within the program. Regards, Huy Jeff Epler wrote: > When using os.syst

Re: "also" to balance "else" ?

2005-06-15 Thread Ron Adam
Terry Hancock wrote: > On Wednesday 15 June 2005 03:57 am, Fredrik Lundh wrote: > >>where your "abnormal behaviour" is, of course, the expected >>behaviour. if you insist on looking at things the wrong way, >>things will look reversed. > > Unfortunately, the converse is true, too: no matter how

splitting delimited strings

2005-06-15 Thread Mark Harrison
What is the best way to process a text file of delimited strings? I've got a file where strings are quoted with at-signs, @like [EMAIL PROTECTED] At-signs in the string are represented as doubled @@. What's the most efficient way to process this? Failing all else I will split the string into char

Re: splitting delimited strings

2005-06-15 Thread Paul McNett
Mark Harrison wrote: > What is the best way to process a text file of delimited strings? > I've got a file where strings are quoted with at-signs, @like [EMAIL > PROTECTED] > At-signs in the string are represented as doubled @@. Have you taken a look at the csv module yet? No guarantees, but it m

Re: "also" to balance "else" ?

2005-06-15 Thread Ron Adam
Nicolas Fleury wrote: > Ron Adam wrote: > >> It occurred to me (a few weeks ago while trying to find the best way >> to form a if-elif-else block, that on a very general level, an 'also' >> statement might be useful. So I was wondering what others would think >> of it. > > But the feature i

Re: splitting delimited strings

2005-06-15 Thread Christoph Rackwitz
You could use regular expressions... it's an FSM of some kind but it's faster *g* check this snippet out: def mysplit(s): pattern = '((?:"[^"]*")|(?:[^ ]+))' tmp = re.split(pattern, s) res = [ifelse(i[0] in ('"',"'"), lambda:i[1:-1], lambda:i) for i in tmp if i.strip()]

Re: pyunit: remove a test case on the fly

2005-06-15 Thread Konstantin Veretennicov
On 15 Jun 2005 14:13:09 -0700, chris <[EMAIL PROTECTED]> wrote: > We have a number of TestCase classes that have multiple test methods. > We are interested in removing any of the individual test methods on the > fly (dynamically, at runtime, whatever). Here's a simple approach imitating NUnit's Ca

Re: splitting delimited strings

2005-06-15 Thread Nicola Mingotti
On Wed, 15 Jun 2005 23:03:55 +, Mark Harrison wrote: > What's the most efficient way to process this? Failing all > else I will split the string into characters and use a FSM, > but it seems that's not very pythonesqe. like this ? >>> s = "@[EMAIL PROTECTED]@@[EMAIL PROTECTED]" >>> s.split

Re: splitting delimited strings

2005-06-15 Thread John Machin
Mark Harrison wrote: > What is the best way to process a text file of delimited strings? > I've got a file where strings are quoted with at-signs, @like [EMAIL > PROTECTED] > At-signs in the string are represented as doubled @@. > > What's the most efficient way to process this? Failing all > el

Re: splitting delimited strings

2005-06-15 Thread John Machin
Nicola Mingotti wrote: > On Wed, 15 Jun 2005 23:03:55 +, Mark Harrison wrote: > > >>What's the most efficient way to process this? Failing all >>else I will split the string into characters and use a FSM, >>but it seems that's not very pythonesqe. > > > like this ? No, not like that. The

Re: splitting delimited strings

2005-06-15 Thread Mark Harrison
Paul McNett <[EMAIL PROTECTED]> wrote: > Mark Harrison wrote: > > What is the best way to process a text file of delimited strings? > > I've got a file where strings are quoted with at-signs, @like [EMAIL > > PROTECTED] > > At-signs in the string are represented as doubled @@. > > Have you taken

RE: Finding Word and switch focus to it

2005-06-15 Thread Hughes, Chad O
The first part is easy. I will have to think about the second part. To find an opened copy of Word and switch focus to it do the following: from win32com.client import Dispatch word = Dispatch('Word.Application') wdWindowStateNormal = 0 if len(word.Documents): word.Activate() if word.WindowSta

access properties of parent widget in Tkinter

2005-06-15 Thread William Gill
I am trying to get & set the properties of a widget's parent widget. What I have works, but seems like a long way around the block. First I get the widget name using w.winfo_parent(), then i convert the name to a reference using nametowidget(). self.nametowidget(event.widget.winfo_parent())

RE: Finding Word and switch focus to it

2005-06-15 Thread Hughes, Chad O
Consider reading this post. It highlights how to do what you want: http://mail.python.org/pipermail/python-win32/2002-April/000322.html Chad -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of John Henry Sent: Wednesday, June 15, 2005 3:21 PM To: python-list@

Re: Cause for using objects?

2005-06-15 Thread Steve Holden
John Heasly wrote: > Given: > [{"mugshot": "nw_gradspeaker4_0608", "width": 67.0, "height": 96.0}, \ > {"mugshot": "nw_gradspeaker2_0608", "width": 67.0, "height": 96.0}, \ > {"freehand": "b1.developreport.0614", "width": 154.0, "height": > 210.0}, \ > {"graphic": "bz_cafep

Re: MySQLDBAPI

2005-06-15 Thread Gregory Piñero
Ok, I finally got it working! I just did these two commands: $export mysqlclient=mysqlclient $export mysqlstatic=True Thanks for all the help everyone. -Greg On 6/14/05, Gregory Piñero <[EMAIL PROTECTED]> wrote: > One other note, the few searches I've made that seem somewhat relevant > talk a

Re: splitting delimited strings

2005-06-15 Thread Leif K-Brooks
Mark Harrison wrote: > What is the best way to process a text file of delimited strings? > I've got a file where strings are quoted with at-signs, @like [EMAIL > PROTECTED] > At-signs in the string are represented as doubled @@. >>> import re >>> _at_re = re.compile('(?>> def split_at_line(line):

Re: splitting delimited strings

2005-06-15 Thread Paul McGuire
Mark - Let me weigh in with a pyparsing entry to your puzzle. It wont be blazingly fast, but at least it will give you another data point in your comparison of approaches. Note that the parser can do the string-to-int conversion for you during the parsing pass. If @rv@ and @pv@ are record type

  1   2   >